Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5804

Approximating arc with non-rational, cubic Bezier

$
0
0

I couldn’t find the solution for this online, so I solved this myself and wanted to share.

Given a (circular) arc between 0° and 180°, what non-rational, cubic Bezier curve can approximate this arc while maintaining G2 continuity at both ends?

The following image shows the start of the work to obtain it. The first equation is a simplified form of eq. 2.13 in https://scholarsarchive.byu.edu/cgi/viewcontent.cgi?article=1000&context=facpub
The remaining work is constructing a quadratic equation for t and solving. The curve can then be constructed by using t as the distance from the end points of the curve to the two interior control points.

image

Python:

cos_ = math.cos((math.pi/2.0)-arc_angle)
tan_ = math.tan(arc_angle/2.0)
sqrt_ = (1.0 + 6.0*tan_/cos_)**0.5
t = radius * cos_ * (sqrt_ - 1.0) / 3.0

The following table includes alternative ways to construct the non-rational, cubic Bezier. The Stack Overflow solution is found at
geometry - How to create circle with Bézier curves? - Stack Overflow

Arc:				 CentralAngle: 90.00			           Radius: 1.000000

RC's Arc.ToNurbsCurve (non-rat'l):	DevFromArc: 0.002727  StartRadius: 0.868325  EndRadius: 0.868325
Rebuild (preserveTans=False):		DevFromArc: 0.002727  StartRadius: 0.868325  EndRadius: 0.868325
Rebuild (preserveTans=True):		DevFromArc: 0.009540  StartRadius: 0.919482  EndRadius: 0.919482
Solution on Stack Overflow:		    DevFromArc: 0.000272  StartRadius: 1.021917  EndRadius: 1.021917
Solution by SPB:			        DevFromArc: 0.001963  StartRadius: 1.000000  EndRadius: 1.000000

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5804

Trending Articles