- Implemented VectorN TransformQuaternion methods. Unittests are green now.

This commit is contained in:
SND\xToast_cp 2011-11-23 11:37:06 +00:00
parent d8693b5023
commit 8e16ace816
4 changed files with 22 additions and 10 deletions

View File

@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
[assembly: AssemblyVersion("0.4.26.*")]
[assembly: AssemblyFileVersion("0.4.26.0")]
[assembly: AssemblyVersion("0.4.27.*")]
[assembly: AssemblyFileVersion("0.4.27.0")]
[assembly:InternalsVisibleTo("ANX.Framework.Windows.DX10")]
[assembly:InternalsVisibleTo("ANX.RenderSystem.Windows.DX11")]

View File

@ -448,7 +448,12 @@ namespace ANX.Framework
public static void Transform(ref Vector2 value, ref Quaternion rotation, out Vector2 result)
{
throw new NotImplementedException();
float x = 2 * (-rotation.Z * value.Y);
float y = 2 * (rotation.Z * value.X);
float z = 2 * (rotation.X * value.Y - rotation.Y * value.X);
result.X = value.X + x * rotation.W + (rotation.Y * z - rotation.Z * y);
result.Y = value.Y + y * rotation.W + (rotation.Z * x - rotation.X * z);
}
public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix, Vector2[] destinationArray, int destinationIndex, int length)

View File

@ -534,13 +534,13 @@ namespace ANX.Framework
public static void Transform(ref Vector3 value, ref Quaternion rotation, out Vector3 result)
{
result.X = (rotation.Y * value.Z - rotation.Z * value.Y);
result.Y = (rotation.Z * value.X - rotation.X * value.Z);
result.Z = (rotation.X * value.Y - rotation.Y * value.X);
float x = 2* (rotation.Y * value.Z - rotation.Z * value.Y);
float y = 2* (rotation.Z * value.X - rotation.X * value.Z);
float z = 2* (rotation.X * value.Y - rotation.Y * value.X);
result.X = value.X + result.X * rotation.W + (rotation.Y * result.Z - rotation.Z * result.Y);
result.Y = value.Y + result.Y * rotation.W + (rotation.Z * result.X - rotation.X * result.Z);
result.Z = value.Z + result.Z * rotation.W + (rotation.X * result.Y - rotation.Y * result.X);
result.X = value.X + x * rotation.W + (rotation.Y * z - rotation.Z * y);
result.Y = value.Y + y * rotation.W + (rotation.Z * x - rotation.X * z);
result.Z = value.Z + z * rotation.W + (rotation.X * y - rotation.Y * x);
}
public static void Transform(Vector3[] sourceArray, ref Matrix matrix, Vector3[] destinationArray)

View File

@ -529,7 +529,14 @@ namespace ANX.Framework
public static void Transform(ref Vector4 value, ref Quaternion rotation, out Vector4 result)
{
throw new NotImplementedException();
float x = 2 * (rotation.Y * value.Z - rotation.Z * value.Y);
float y = 2 * (rotation.Z * value.X - rotation.X * value.Z);
float z = 2 * (rotation.X * value.Y - rotation.Y * value.X);
result.X = value.X + x * rotation.W + (rotation.Y * z - rotation.Z * y);
result.Y = value.Y + y * rotation.W + (rotation.Z * x - rotation.X * z);
result.Z = value.Z + z * rotation.W + (rotation.X * y - rotation.Y * x);
result.W = value.W;
}
public static void Transform(Vector4[] sourceArray, ref Matrix matrix, Vector4[] destinationArray)