4 using System.Runtime.CompilerServices;
5 using SiliconStudio.Core.Mathematics;
7 namespace SiliconStudio.
Paradox.DataModel
16 public static void Cubic(ref Core.Mathematics.Vector3 value1, ref Core.Mathematics.Vector3 value2, ref Core.Mathematics.Vector3 value3, ref Core.Mathematics.Vector3 value4,
float t, out Core.Mathematics.Vector3 result)
22 float factor0 = -t3 + 2.0f * t2 - t;
23 float factor1 = 3.0f * t3 - 5.0f * t2 + 2.0f;
24 float factor2 = -3.0f * t3 + 4.0f * t2 + t;
25 float factor3 = t3 - t2;
28 result.X = 0.5f * (value1.X * factor0 + value2.X * factor1 + value3.X * factor2 + value4.X * factor3);
29 result.Y = 0.5f * (value1.Y * factor0 + value2.Y * factor1 + value3.Y * factor2 + value4.Y * factor3);
30 result.Z = 0.5f * (value1.Z * factor0 + value2.Z * factor1 + value3.Z * factor2 + value4.Z * factor3);
33 [MethodImpl(MethodImplOptions.AggressiveInlining)]
34 public static void Linear(ref Core.Mathematics.Vector3 value1, ref Core.Mathematics.Vector3 value2,
float t, out Core.Mathematics.Vector3 result)
36 Core.Mathematics.Vector3.Lerp(ref value1, ref value2, t, out result);
42 public static void Cubic(ref Core.Mathematics.Quaternion value1, ref Core.Mathematics.Quaternion value2, ref Core.Mathematics.Quaternion value3, ref Core.Mathematics.Quaternion value4,
float t, out Core.Mathematics.Quaternion result)
45 throw new NotImplementedException();
48 [MethodImpl(MethodImplOptions.AggressiveInlining)]
49 public static void SphericalLinear(ref Core.Mathematics.Quaternion value1, ref Core.Mathematics.Quaternion value2,
float t, out Core.Mathematics.Quaternion result)
51 Core.Mathematics.Quaternion.Slerp(ref value1, ref value2, t, out result);
55 [MethodImpl(MethodImplOptions.AggressiveInlining)]
56 public static float Linear(
float value1,
float value2,
float t)
58 return (1.0f - t) * value1 + t * value2;
61 [MethodImpl(MethodImplOptions.AggressiveInlining)]
62 public static float Cubic(
float value1,
float value2,
float value3,
float value4,
float t)
68 float factor0 = -t3 + 2.0f * t2 - t;
69 float factor1 = 3.0f * t3 - 5.0f * t2 + 2.0f;
70 float factor2 = -3.0f * t3 + 4.0f * t2 + t;
71 float factor3 = t3 - t2;
73 return 0.5f * (value1 * factor0
static void SphericalLinear(ref Core.Mathematics.Quaternion value1, ref Core.Mathematics.Quaternion value2, float t, out Core.Mathematics.Quaternion result)
static void Cubic(ref Core.Mathematics.Vector3 value1, ref Core.Mathematics.Vector3 value2, ref Core.Mathematics.Vector3 value3, ref Core.Mathematics.Vector3 value4, float t, out Core.Mathematics.Vector3 result)
static float Cubic(float value1, float value2, float value3, float value4, float t)
static void Cubic(ref Core.Mathematics.Quaternion value1, ref Core.Mathematics.Quaternion value2, ref Core.Mathematics.Quaternion value3, ref Core.Mathematics.Quaternion value4, float t, out Core.Mathematics.Quaternion result)
static float Linear(float value1, float value2, float t)
static void Linear(ref Core.Mathematics.Vector3 value1, ref Core.Mathematics.Vector3 value2, float t, out Core.Mathematics.Vector3 result)
Various helper functions for float, Vector3 and Quaternion interpolations.