示例#1
0
        /// <summary>
        /// Rotate the control points by the defined value in radians.
        /// </summary>
        /// <param name="value">The amount to rotate by in radians.</param>
        public void Rotate(float value)
        {
            var rotation = Complex.FromAngle(value);

            for (int i = 0; i < ControlPoints.Count; i++)
            {
                ControlPoints[i] = Complex.Multiply(ControlPoints[i], ref rotation);
            }
        }
示例#2
0
文件: Math.cs 项目: jocamar/Caravel
        /// <summary>
        /// Get the interpolated transform at a specific time.
        /// </summary>
        /// <param name="xfb">The transform.</param>
        /// <param name="beta">beta is a factor in [0,1], where 0 indicates alpha0.</param>
        public void GetTransform(out Transform xfb, float beta)
        {
            xfb     = new Transform();
            xfb.p.X = (1.0f - beta) * C0.X + beta * C.X;
            xfb.p.Y = (1.0f - beta) * C0.Y + beta * C.Y;
            float angle = (1.0f - beta) * A0 + beta * A;

            xfb.q.Phase = angle;

            // Shift to origin
            xfb.p -= Complex.Multiply(ref LocalCenter, ref xfb.q);
        }
示例#3
0
文件: Math.cs 项目: jocamar/Caravel
 public static void Multiply(ref Transform left, Complex right, out Transform result)
 {
     result.p = Complex.Multiply(ref left.p, ref right);
     result.q = Complex.Multiply(ref left.q, ref right);
 }
示例#4
0
文件: Math.cs 项目: jocamar/Caravel
 public static Transform Multiply(ref Transform left, ref Transform right)
 {
     return(new Transform(
                Complex.Multiply(ref left.p, ref right.q) + right.p,
                Complex.Multiply(ref left.q, ref right.q)));
 }
示例#5
0
 public static void Multiply(ref Transform left, Complex right, out Transform result)
 {
     result.Position = Complex.Multiply(ref left.Position, ref right);
     result.Rotation = Complex.Multiply(ref left.Rotation, ref right);
 }
示例#6
0
 public static Transform Multiply(ref Transform left, ref Transform right)
 {
     return(new Transform(
                Complex.Multiply(ref left.Position, ref right.Rotation) + right.Position,
                Complex.Multiply(ref left.Rotation, ref right.Rotation)));
 }