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

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

            FP dot = Dot(from, to);

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

            FP halfTheta = FP.Acos(dot);

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

            return(LerpUnclamped(a, b, t));
        }
 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));
 }
 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)));
 }