public float EstimateSegmentLength(int segment, int subdivisions = 50)
        {
            float num = 0f;

            Debug.Assert(nodes.Length > segment, "Invalid segment number.");
            SmoothBezierNode smoothBezierNode  = nodes[segment];
            SmoothBezierNode smoothBezierNode2 = nodes[segment + 1];
            Transform        transform         = smoothBezierNode.transform;
            Transform        transform2        = smoothBezierNode2.transform;
            Vector3          position          = transform.position;
            Vector3          p         = transform.position + transform.forward * smoothBezierNode.OutHandleLength;
            Vector3          p2        = transform2.position - transform2.forward * smoothBezierNode2.InHandleLength;
            Vector3          position2 = transform2.position;
            Vector3          zero      = Vector3.zero;
            Vector3          vector    = BezierMath.Interpolate(position, p, p2, position2, 0f);
            float            num2      = 1f / (float)subdivisions;

            for (int i = 0; i < subdivisions; i++)
            {
                zero   = vector;
                vector = BezierMath.Interpolate(position, p, p2, position2, num2 * (float)(i + 1));
                num   += Vector3.Distance(zero, vector);
            }
            return(num);
        }
        public Vector3 InterpolateSegment(int segment, float u)
        {
            Debug.Assert(nodes.Length > segment, "Invalid segment number.");
            SmoothBezierNode smoothBezierNode  = nodes[segment];
            SmoothBezierNode smoothBezierNode2 = nodes[segment + 1];
            Transform        transform         = smoothBezierNode.transform;
            Transform        transform2        = smoothBezierNode2.transform;
            Vector3          position          = transform.position;
            Vector3          p         = transform.position + transform.forward * smoothBezierNode.OutHandleLength;
            Vector3          p2        = transform2.position - transform2.forward * smoothBezierNode2.InHandleLength;
            Vector3          position2 = transform2.position;

            return(BezierMath.Interpolate(position, p, p2, position2, u));
        }