OpenTK.BezierCurve.CalculatePoint C# (CSharp) 메소드

CalculatePoint() 공개 정적인 메소드

Calculates the point on the given bezier curve with the specified t parameter.
public static CalculatePoint ( IList points, float t ) : System.Vector2
points IList The points.
t float The t parameter, a value between 0.0f and 1.0f.
리턴 System.Vector2
        public static Vector2 CalculatePoint(IList<Vector2> points, float t)
        {
            return BezierCurve.CalculatePoint(points, t, 0.0f);
        }

Same methods

BezierCurve::CalculatePoint ( IList points, float t, float parallel ) : System.Vector2
BezierCurve::CalculatePoint ( float t ) : System.Vector2

Usage Example

        /// <summary>
        /// Calculates the length of the specified bezier curve.
        /// </summary>
        /// <param name="points">The points.</param>
        /// <param name="precision">The precision value.</param>
        /// <param name="parallel">The parallel value.</param>
        /// <returns>Length of curve.</returns>
        /// <remarks><para>The precision gets better as the <paramref name="precision"/>
        /// value gets smaller.</para>
        /// <para>The <paramref name="parallel"/> parameter defines whether the curve should be calculated as a
        /// parallel curve to the original bezier curve. A value of 0.0f represents
        /// the original curve, 5.0f represents a curve that has always a distance
        /// of 5.0f to the orignal curve.</para></remarks>
        public static float CalculateLength(IList <Vector2> points, float precision, float parallel)
        {
            float   length = 0.0f;
            Vector2 old    = BezierCurve.CalculatePoint(points, 0.0f, parallel);

            for (float i = precision; i < (1.0f + precision); i += precision)
            {
                Vector2 n = CalculatePoint(points, i, parallel);
                length += (n - old).Length;
                old     = n;
            }

            return(length);
        }
All Usage Examples Of OpenTK.BezierCurve::CalculatePoint