Find the Length of the Bezier Curve having 4 Control Points

175 Views Asked by At

I am unable to get the exact length of Bezier curve having 4 Control points. Please give your suggestion to calculate exact length of Bezier curve. Please explain more about k1, k2, k3, k4 in the below code.

double BezierArcLength(point2d p1, point2d p2, point2d p3, point2d p4)
{
    point2d k1, k2, k3, k4;

    k1 = -p1 + 3*(p2 - p3) + p4;
    k2 = 3*(p1 + p3) - 6*p2;
    k3 = 3*(p2 - p1);
    k4 = p1;

    q1 = 9.0*(sqr(k1.x) + sqr(k1.y));
    q2 = 12.0*(k1.x*k2.x + k1.y*k2.y);
    q3 = 3.0*(k1.x*k3.x + k1.y*k3.y) + 4.0*(sqr(k2.x) + sqr(k2.y));
    q4 = 4.0*(k2.x*k3.x + k2.y*k3.y);
    q5 = sqr(k3.x) + sqr(k3.y);

    double result = Simpson(balf, 0, 1, 1024, 0.001);
    return result;
}

Thank you Friends, Nathan

1

There are 1 best solutions below

0
On

k1, k2, k3 and k4 are the coefficient of the cubic Bezier curve when represented in power basis. Namely,

$C(t)=P_1(1-t)^3+3P_2t(1-t)^2+3P_3t^2(1-t)+P_4 = k_1t^3+k_2t^2+k_3t+k_4$