Пример #1
0
        public static Vec2f Slerp(Vec2f x, Vec2f y, float a)
        {
            // Dot product - the cosine of the angle between 2 vectors.
            var dot = Vec2f.Dot(x, y);

            // Clamp it to be in the range of Acos()
            dot = MathF.Clamp(dot, -1.0f, 1.0f);

            float theta       = MathF.Acos(dot) * a;
            var   relativeVec = Vec2f.Normalize(y - x * dot); // Orthonormal basis

            return((x * MathF.Cos(theta)) + (relativeVec * MathF.Sin(theta)));
        }
Пример #2
0
 public static float GetAngle(Quatf q)
 {
     //return (float)MathFunctions.Degrees((float)Math.Acos(q.w) * 2.0f);
     return(MathF.ToDegrees(MathF.Acos(q.w) * 2.0f));
 }