Esempio n. 1
0
        /// <summary>
        ///   b and c are controllers. a and d are statics. AB is origin and CD is dest
        /// </summary>
        /// <param name="dest"> </param>
        /// <param name="ptA"> </param>
        /// <param name="ptB"> dest </param>
        /// <param name="ptC"> </param>
        /// <param name="ptD"> </param>
        /// <param name="t"> </param>
        public static void DGetBezierValue(out DVector2 dest, DVector2 ptA, DVector2 ptB, DVector2 ptC, DVector2 ptD, double t)
        {
            var ab = new DVector2();
            var bc = new DVector2();
            var cd = new DVector2();
            var abbc = new DVector2();
            var bccd = new DVector2();

            dest = new DVector2();

            DLerp(ref ab, ptA, ptB, t);
            DLerp(ref bc, ptB, ptC, t);
            DLerp(ref cd, ptC, ptD, t);
            DLerp(ref abbc, ab, bc, t);
            DLerp(ref bccd, bc, cd, t);
            DLerp(ref dest, abbc, bccd, t);
        }
Esempio n. 2
0
 static void DLerp(ref DVector2 dest, DVector2 a, DVector2 b, double t)
 {
     dest.X = a.X + (b.X - a.X)*t;
     dest.Y = a.Y + (b.Y - a.Y)*t;
 }