Skip to content

Commit 9497be8

Browse files
committed
Recovered Old Quaternion implementation.
1 parent 0345ba5 commit 9497be8

6 files changed

Lines changed: 99 additions & 238 deletions

File tree

sources/Maths/Maths/Matrix2X3.Ops.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ public static Matrix2X3<T> CreateFromAxisAngle<T>(Vector3D<T> axis, T angle)
9494
/// <summary>Creates a rotation matrix from the given Quaternion rotation value.</summary>
9595
/// <param name="quaternion">The source Quaternion.</param>
9696
/// <returns>The rotation matrix.</returns>
97-
public static Matrix2X3<T> CreateFromQuaternion<T>(Silk.NET.Maths.Legacy.Quaternion<T> quaternion)
98-
where T : INumberBase<T>
97+
public static Matrix2X3<T> CreateFromQuaternion<T>(Quaternion<T> quaternion)
98+
where T : ITrigonometricFunctions<T>
9999
{
100100
Matrix2X3<T> result = Matrix2X3<T>.Identity;
101101

@@ -128,18 +128,18 @@ public static Matrix2X3<T> CreateFromQuaternion<T>(Silk.NET.Maths.Legacy.Quatern
128128
/// <param name="roll">Angle of rotation, in radians, around the Z-axis.</param>
129129
/// <returns>The rotation matrix.</returns>
130130
public static Matrix2X3<T> CreateFromYawPitchRoll<T>(T yaw, T pitch, T roll)
131-
where T : INumberBase<T>
131+
where T : ITrigonometricFunctions<T>
132132
{
133-
Legacy.Quaternion<T> q = Legacy.Quaternion<T>.CreateFromYawPitchRoll(yaw, pitch, roll);
133+
var q = Quaternion<T>.CreateFromYawPitchRoll(yaw, pitch, roll);
134134
return CreateFromQuaternion(q);
135135
}
136136

137137
/// <summary>Transforms the given matrix by applying the given Quaternion rotation.</summary>
138138
/// <param name="value">The source matrix to transform.</param>
139139
/// <param name="rotation">The rotation to apply.</param>
140140
/// <returns>The transformed matrix.</returns>
141-
public static Matrix2X3<T> Transform<T>(Matrix2X3<T> value, Legacy.Quaternion<T> rotation)
142-
where T : INumberBase<T>
141+
public static Matrix2X3<T> Transform<T>(Matrix2X3<T> value, Quaternion<T> rotation)
142+
where T : ITrigonometricFunctions<T>
143143
{
144144
// Compute rotation matrix.
145145
T x2 = Scalar.Add(rotation.X, rotation.X);

sources/Maths/Maths/Matrix3X3.Ops.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ public static Matrix3X3<T> CreateFromAxisAngle<T>(Vector3D<T> axis, T angle)
119119
/// <summary>Creates a rotation matrix from the given Quaternion rotation value.</summary>
120120
/// <param name="quaternion">The source Quaternion.</param>
121121
/// <returns>The rotation matrix.</returns>
122-
public static Matrix3X3<T> CreateFromQuaternion<T>(Silk.NET.Maths.Legacy.Quaternion<T> quaternion)
123-
where T : INumberBase<T>
122+
public static Matrix3X3<T> CreateFromQuaternion<T>(Quaternion<T> quaternion)
123+
where T : ITrigonometricFunctions<T>
124124
{
125125
Matrix3X3<T> result = Matrix3X3<T>.Identity;
126126

@@ -157,9 +157,9 @@ public static Matrix3X3<T> CreateFromQuaternion<T>(Silk.NET.Maths.Legacy.Quatern
157157
/// <param name="roll">Angle of rotation, in radians, around the Z-axis.</param>
158158
/// <returns>The rotation matrix.</returns>
159159
public static Matrix3X3<T> CreateFromYawPitchRoll<T>(T yaw, T pitch, T roll)
160-
where T : INumberBase<T>
160+
where T : ITrigonometricFunctions<T>
161161
{
162-
Legacy.Quaternion<T> q = Legacy.Quaternion<T>.CreateFromYawPitchRoll(yaw, pitch, roll);
162+
var q = Quaternion<T>.CreateFromYawPitchRoll(yaw, pitch, roll);
163163
return CreateFromQuaternion(q);
164164
}
165165

@@ -475,8 +475,8 @@ public static bool Decompose<T>(Matrix3X3<T> matrix, out Vector3D<T> scale, out
475475
/// <param name="value">The source matrix to transform.</param>
476476
/// <param name="rotation">The rotation to apply.</param>
477477
/// <returns>The transformed matrix.</returns>
478-
public static Matrix3X3<T> Transform<T>(Matrix3X3<T> value, Legacy.Quaternion<T> rotation)
479-
where T : INumberBase<T>
478+
public static Matrix3X3<T> Transform<T>(Matrix3X3<T> value, Quaternion<T> rotation)
479+
where T : ITrigonometricFunctions<T>
480480
{
481481
// Compute rotation matrix.
482482
T x2 = Scalar.Add(rotation.X, rotation.X);

sources/Maths/Maths/Matrix4X4.Ops.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ public static Matrix4X4<T> CreateFromAxisAngle<T>(Vector3D<T> axis, T angle)
189189
/// <summary>Creates a rotation matrix from the given Quaternion rotation value.</summary>
190190
/// <param name="quaternion">The source Quaternion.</param>
191191
/// <returns>The rotation matrix.</returns>
192-
public static Matrix4X4<T> CreateFromQuaternion<T>(Silk.NET.Maths.Legacy.Quaternion<T> quaternion)
193-
where T : INumberBase<T>
192+
public static Matrix4X4<T> CreateFromQuaternion<T>(Quaternion<T> quaternion)
193+
where T : ITrigonometricFunctions<T>
194194
{
195195
Matrix4X4<T> result = Matrix4X4<T>.Identity;
196196

@@ -227,9 +227,9 @@ public static Matrix4X4<T> CreateFromQuaternion<T>(Silk.NET.Maths.Legacy.Quatern
227227
/// <param name="roll">Angle of rotation, in radians, around the Z-axis.</param>
228228
/// <returns>The rotation matrix.</returns>
229229
public static Matrix4X4<T> CreateFromYawPitchRoll<T>(T yaw, T pitch, T roll)
230-
where T : INumberBase<T>
230+
where T : ITrigonometricFunctions<T>
231231
{
232-
Legacy.Quaternion<T> q = Legacy.Quaternion<T>.CreateFromYawPitchRoll(yaw, pitch, roll);
232+
var q = Quaternion<T>.CreateFromYawPitchRoll(yaw, pitch, roll);
233233
return CreateFromQuaternion(q);
234234
}
235235

@@ -1404,8 +1404,8 @@ public static bool Decompose<T>(Matrix4X4<T> matrix, out Vector3D<T> scale, out
14041404
/// <param name="value">The source matrix to transform.</param>
14051405
/// <param name="rotation">The rotation to apply.</param>
14061406
/// <returns>The transformed matrix.</returns>
1407-
public static Matrix4X4<T> Transform<T>(Matrix4X4<T> value, Legacy.Quaternion<T> rotation)
1408-
where T : INumberBase<T>
1407+
public static Matrix4X4<T> Transform<T>(Matrix4X4<T> value, Quaternion<T> rotation)
1408+
where T : ITrigonometricFunctions<T>
14091409
{
14101410
// Compute rotation matrix.
14111411
T x2 = Scalar.Add(rotation.X, rotation.X);

sources/Maths/Maths/Plane.Ops.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ public static Plane<T> Transform<T>(Plane<T> plane, Matrix4X4<T> matrix)
182182
/// <param name="rotation">The Quaternion rotation to apply to the Plane.</param>
183183
/// <returns>A new Plane that results from applying the rotation.</returns>
184184
[MethodImpl((MethodImplOptions) 768)]
185-
public static Plane<T> Transform<T>(Plane<T> plane, Legacy.Quaternion<T> rotation)
186-
where T : INumberBase<T>
185+
public static Plane<T> Transform<T>(Plane<T> plane, Quaternion<T> rotation)
186+
where T : ITrigonometricFunctions<T>
187187
{
188188
// Compute rotation matrix.
189189
T x2 = Scalar.Add(rotation.X, rotation.X);

0 commit comments

Comments
 (0)