OpenTK.BezierCurveCubic.CalculateLength C# (CSharp) Method

CalculateLength() public method

Calculates the length of this bezier curve.
The precision gets better when the precision value gets smaller.
public CalculateLength ( float precision ) : float
precision float The precision.
return float
        public float CalculateLength(float precision)
        {
            float length = 0.0f;
            Vector2 old = CalculatePoint(0.0f);
            for (float i = precision; i < (1.0f + precision); i += precision)
            {
                Vector2 n = CalculatePoint(i);
                length += (n - old).Length;
                old = n;
            }

            return length;
        }