Esempio n. 1
0
        public static FPVector2 Lerp(FPVector2 value1, FPVector2 value2, Fix64 amount)
        {
            amount = FPMath.Clamp(amount, 0, 1);

            return(new FPVector2(
                       FPMath.Lerp(value1.x, value2.x, amount),
                       FPMath.Lerp(value1.y, value2.y, amount)));
        }
Esempio n. 2
0
        public static FPQuaternion Slerp(FPQuaternion from, FPQuaternion to, Fix64 t)
        {
            t = FPMath.Clamp(t, 0, 1);

            Fix64 dot = Dot(from, to);

            if (dot < 0.0f)
            {
                to  = Multiply(to, -1);
                dot = -dot;
            }

            Fix64 halfTheta = Fix64.Acos(dot);

            return(Multiply(Multiply(from, Fix64.Sin((1 - t) * halfTheta)) + Multiply(to, Fix64.Sin(t * halfTheta)), 1 / Fix64.Sin(halfTheta)));
        }
Esempio n. 3
0
        public static FPQuaternion Lerp(FPQuaternion a, FPQuaternion b, Fix64 t)
        {
            t = FPMath.Clamp(t, Fix64.Zero, Fix64.One);

            return(LerpUnclamped(a, b, t));
        }
Esempio n. 4
0
 public static void Clamp(ref FPVector2 value1, ref FPVector2 min, ref FPVector2 max, out FPVector2 result)
 {
     result = new FPVector2(
         FPMath.Clamp(value1.x, min.x, max.x),
         FPMath.Clamp(value1.y, min.y, max.y));
 }
Esempio n. 5
0
 public static FPVector2 Clamp(FPVector2 value1, FPVector2 min, FPVector2 max)
 {
     return(new FPVector2(
                FPMath.Clamp(value1.x, min.x, max.x),
                FPMath.Clamp(value1.y, min.y, max.y)));
 }