MaxScript Circle using Bézier Curves

This article explains the way i have found to build a Circle using Bézier Curves. I have used 3DSMax and MaxScript to build it, but, of course, it’s the same within any software.  Cubic Bézier  Formula is next:

Bezier Curve Formula

Well, s0, the P0 P1 P2 and P3 are the control points that define the Curve. The t is the position we would like to calculate. So, the start of the Curve is 0 and the End is 1. The definition says that P0 and P1 belongs to the path of the Curve. So, let’s build a 1 unit radius Circle.


As we see in the image, we have divided the circle into 4 pieces, and we will work only with the bold arc. So, the control points, A, A’, B’ and B are:

A ( 0, 1 ), A’ ( x, 1 ), B’ ( 1, x ) and B ( 1, 0 ).

The other thing we know is that the point C belongs to the Curve, and it’s exactly in t ( 1/2 ).

So, in order to calculate the x ( distance between B – B’ or A – A’, we only have to use the Bézier Curve formula, replacing the first of the Control Point values in the formula, with t = 1/2, and equalise it with sin 45. The result of x is 0.551915024494. So, the code to build the Circle in Max Script is the next:

radius = 5.0
c = 0.551915024494 * radius
controlShape = splineshape()
addnewspline controlShape
addknot controlShape 1 #bezier #curve [radius, 0.0, 0.0] [radius, c, 0.0] [radius, -c, 0.0]
addknot controlShape 1 #bezier #curve [0.0, -radius, 0.0] [c, -radius, 0.0] [-c, -radius, 0.0]
addknot controlShape 1 #bezier #curve [-radius, 0.0, 0.0] [-radius, -c, 0.0] [-radius, c, 0.0]
addknot controlShape 1 #bezier #curve [0.0, radius, 0.0] [-c, radius, 0.0] [c, radius, 0.0]
close controlShape 1
updateshape controlShape

Leave a Reply

Your email address will not be published. Required fields are marked *