Sunday, September 1, 2019

mathematics - Bezier curve arc length



See also: same question on Math.SE



How can I find the arclength of a Bezier curve? For example, a linear Bezier curve has the length:


length = sqrt(pow(x[1] - x[0], 2) + pow(y[1] - y[0], 2));

But what about quadratic, cubic, or n-degree Bezier curves?


(My goal was to estimate a sampling resolution beforehand, so I don't have to waste time checking if the next point is touching the previous point.)



Answer




A simple way for cubic Beziers is to split the curve into N segments and sum the segments' lengths.


However, as soon as you need the length of only part of the curve (e.g. up to a point 30% of the length along), arc-length parameterization will come into play. I posted a fairly long answer on one of my own questions about Béziers, with simple sample code.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...