From 2f8d7092bc2c9609fa98d6888106b96f38b22828 Mon Sep 17 00:00:00 2001 From: dan miller Date: Sun, 21 Oct 2007 08:36:32 +0000 Subject: libraries moved to opensim-libs, a new repository --- .../ModifiedBulletX/MonoXnaCompactMaths/Matrix.cs | 690 --------------------- .../MonoXnaCompactMaths/MonoXnaCompactMaths.csproj | 51 -- .../MonoXnaCompactMaths/Properties/AssemblyInfo.cs | 33 - .../MonoXnaCompactMaths/Quaternion.cs | 431 ------------- .../ModifiedBulletX/MonoXnaCompactMaths/Vector3.cs | 620 ------------------ .../ModifiedBulletX/MonoXnaCompactMaths/Vector4.cs | 630 ------------------- 6 files changed, 2455 deletions(-) delete mode 100644 libraries/ModifiedBulletX/MonoXnaCompactMaths/Matrix.cs delete mode 100644 libraries/ModifiedBulletX/MonoXnaCompactMaths/MonoXnaCompactMaths.csproj delete mode 100644 libraries/ModifiedBulletX/MonoXnaCompactMaths/Properties/AssemblyInfo.cs delete mode 100644 libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs delete mode 100644 libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector3.cs delete mode 100644 libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector4.cs (limited to 'libraries/ModifiedBulletX/MonoXnaCompactMaths') diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Matrix.cs b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Matrix.cs deleted file mode 100644 index 9b88ab3..0000000 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Matrix.cs +++ /dev/null @@ -1,690 +0,0 @@ -#region License -/* -MIT License -Copyright © 2006 The Mono.Xna Team - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ -#endregion License - -using System; -using System.ComponentModel; -using System.Runtime.InteropServices; - -namespace MonoXnaCompactMaths -{ - [Serializable] - [StructLayout(LayoutKind.Sequential)] - //[TypeConverter(typeof(MatrixConverter))] - public struct Matrix : IEquatable - { - #region Public Constructors - - public Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, - float m32, float m33, float m34, float m41, float m42, float m43, float m44) - { - this.M11 = m11; - this.M12 = m12; - this.M13 = m13; - this.M14 = m14; - this.M21 = m21; - this.M22 = m22; - this.M23 = m23; - this.M24 = m24; - this.M31 = m31; - this.M32 = m32; - this.M33 = m33; - this.M34 = m34; - this.M41 = m41; - this.M42 = m42; - this.M43 = m43; - this.M44 = m44; - } - - #endregion Public Constructors - - - #region Public Fields - - public float M11; - public float M12; - public float M13; - public float M14; - public float M21; - public float M22; - public float M23; - public float M24; - public float M31; - public float M32; - public float M33; - public float M34; - public float M41; - public float M42; - public float M43; - public float M44; - - #endregion Public Fields - - - #region Private Members - private static Matrix identity = new Matrix(1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f); - #endregion Private Members - - - #region Public Properties - - public Vector3 Backward - { - get - { - return new Vector3(this.M31, this.M32, this.M33); - } - set - { - this.M31 = value.X; - this.M32 = value.Y; - this.M33 = value.Z; - } - } - - - public Vector3 Down - { - get - { - return new Vector3(-this.M21, -this.M22, -this.M23); - } - set - { - this.M21 = -value.X; - this.M22 = -value.Y; - this.M23 = -value.Z; - } - } - - - public Vector3 Forward - { - get - { - return new Vector3(-this.M31, -this.M32, -this.M33); - } - set - { - this.M31 = -value.X; - this.M32 = -value.Y; - this.M33 = -value.Z; - } - } - - - public static Matrix Identity - { - get { return identity; } - } - - - public Vector3 Left - { - get - { - return new Vector3(-this.M11, -this.M12, -this.M13); - } - set - { - this.M11 = -value.X; - this.M12 = -value.Y; - this.M13 = -value.Z; - } - } - - - public Vector3 Right - { - get - { - return new Vector3(this.M11, this.M12, this.M13); - } - set - { - this.M11 = value.X; - this.M12 = value.Y; - this.M13 = value.Z; - } - } - - - public Vector3 Translation - { - get - { - return new Vector3(this.M41, this.M42, this.M43); - } - set - { - this.M41 = value.X; - this.M42 = value.Y; - this.M43 = value.Z; - } - } - - - public Vector3 Up - { - get - { - return new Vector3(this.M21, this.M22, this.M23); - } - set - { - this.M21 = value.X; - this.M22 = value.Y; - this.M23 = value.Z; - } - } - #endregion Public Properties - - - #region Public Methods - - public static Matrix Add(Matrix matrix1, Matrix matrix2) - { - throw new NotImplementedException(); - } - - - public static void Add(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateBillboard(Vector3 objectPosition, Vector3 cameraPosition, - Vector3 cameraUpVector, Nullable cameraForwardVector) - { - throw new NotImplementedException(); - } - - - public static void CreateBillboard(ref Vector3 objectPosition, ref Vector3 cameraPosition, - ref Vector3 cameraUpVector, Vector3? cameraForwardVector, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateConstrainedBillboard(Vector3 objectPosition, Vector3 cameraPosition, - Vector3 rotateAxis, Nullable cameraForwardVector, Nullable objectForwardVector) - { - throw new NotImplementedException(); - } - - - public static void CreateConstrainedBillboard(ref Vector3 objectPosition, ref Vector3 cameraPosition, - ref Vector3 rotateAxis, Vector3? cameraForwardVector, Vector3? objectForwardVector, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateFromAxisAngle(Vector3 axis, float angle) - { - throw new NotImplementedException(); - } - - - public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateFromQuaternion(Quaternion quaternion) - { - //--- - //http://lists.ximian.com/pipermail/mono-patches/2006-December/084667.html - float xx = quaternion.X * quaternion.X; - float xy = quaternion.X * quaternion.Y; - float xw = quaternion.X * quaternion.W; - float yy = quaternion.Y * quaternion.Y; - float yw = quaternion.Y * quaternion.W; - float yz = quaternion.Y * quaternion.Z; - float zx = quaternion.Z * quaternion.X; - float zw = quaternion.Z * quaternion.W; - float zz = quaternion.Z * quaternion.Z; - return new Matrix(1f - (2f * (yy + zz)), 2f * (xy + zw), 2f * (zx - yw), 0f, 2f * (xy - zw), - 1f - (2f * (zz + xx)), 2f * (yz + xw), 0f, 2f * (zx + yw), 2f * (yz - xw), - 1f - (2f * (yy + xx)), 0f, 0f, 0f, 0f, 1f); - //throw new NotImplementedException(); - } - - - public static void CreateFromQuaternion(ref Quaternion quaternion, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateLookAt(Vector3 cameraPosition, Vector3 cameraTarget, Vector3 cameraUpVector) - { - throw new NotImplementedException(); - } - - - public static void CreateLookAt(ref Vector3 cameraPosition, ref Vector3 cameraTarget, ref Vector3 cameraUpVector, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane) - { - throw new NotImplementedException(); - } - - - public static void CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane) - { - throw new NotImplementedException(); - } - - - public static void CreateOrthographicOffCenter(float left, float right, float bottom, float top, - float zNearPlane, float zFarPlane, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreatePerspective(float width, float height, float zNearPlane, float zFarPlane) - { - throw new NotImplementedException(); - } - - - public static void CreatePerspective(float width, float height, float zNearPlane, float zFarPlane, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float zNearPlane, float zFarPlane) - { - throw new NotImplementedException(); - } - - - public static void CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane) - { - throw new NotImplementedException(); - } - - - public static void CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateRotationX(float radians) - { - throw new NotImplementedException(); - } - - - public static void CreateRotationX(float radians, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateRotationY(float radians) - { - throw new NotImplementedException(); - } - - - public static void CreateRotationY(float radians, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateRotationZ(float radians) - { - throw new NotImplementedException(); - } - - - public static void CreateRotationZ(float radians, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateScale(float scale) - { - throw new NotImplementedException(); - } - - - public static void CreateScale(float scale, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateScale(float xScale, float yScale, float zScale) - { - throw new NotImplementedException(); - } - - - public static void CreateScale(float xScale, float yScale, float zScale, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateScale(Vector3 scales) - { - throw new NotImplementedException(); - } - - - public static void CreateScale(ref Vector3 scales, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateTranslation(float xPosition, float yPosition, float zPosition) - { - throw new NotImplementedException(); - } - - - public static void CreateTranslation(ref Vector3 position, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix CreateTranslation(Vector3 position) - { - throw new NotImplementedException(); - } - - - public static void CreateTranslation(float xPosition, float yPosition, float zPosition, out Matrix result) - { - throw new NotImplementedException(); - } - - - public float Determinant() - { - throw new NotImplementedException(); - } - - - public static Matrix Divide(Matrix matrix1, Matrix matrix2) - { - throw new NotImplementedException(); - } - - - public static void Divide(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix Divide(Matrix matrix1, float divider) - { - throw new NotImplementedException(); - } - - - public static void Divide(ref Matrix matrix1, float divider, out Matrix result) - { - throw new NotImplementedException(); - } - - - public bool Equals(Matrix other) - { - throw new NotImplementedException(); - } - - - public override bool Equals(object obj) - { - throw new NotImplementedException(); - } - - - public override int GetHashCode() - { - throw new NotImplementedException(); - } - - - public static Matrix Invert(Matrix matrix) - { - throw new NotImplementedException(); - } - - - public static void Invert(ref Matrix matrix, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix Lerp(Matrix matrix1, Matrix matrix2, float amount) - { - throw new NotImplementedException(); - } - - - public static void Lerp(ref Matrix matrix1, ref Matrix matrix2, float amount, out Matrix result) - { - throw new NotImplementedException(); - } - - public static Matrix Multiply(Matrix matrix1, Matrix matrix2) - { - throw new NotImplementedException(); - } - - - public static void Multiply(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix Multiply(Matrix matrix1, float factor) - { - throw new NotImplementedException(); - } - - - public static void Multiply(ref Matrix matrix1, float factor, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix Negate(Matrix matrix) - { - throw new NotImplementedException(); - } - - - public static void Negate(ref Matrix matrix, out Matrix result) - { - throw new NotImplementedException(); - } - - - public static Matrix operator +(Matrix matrix1, Matrix matrix2) - { - throw new NotImplementedException(); - } - - - public static Matrix operator /(Matrix matrix1, Matrix matrix2) - { - throw new NotImplementedException(); - } - - - public static Matrix operator /(Matrix matrix1, float divider) - { - return new Matrix( - matrix1.M11 / divider, matrix1.M12 / divider, matrix1.M13 / divider, matrix1.M14 / divider, - matrix1.M21 / divider, matrix1.M22 / divider, matrix1.M23 / divider, matrix1.M24 / divider, - matrix1.M31 / divider, matrix1.M32 / divider, matrix1.M33 / divider, matrix1.M34 / divider, - matrix1.M41 / divider, matrix1.M42 / divider, matrix1.M43 / divider, matrix1.M44 / divider); - } - - - public static bool operator ==(Matrix matrix1, Matrix matrix2) - { - throw new NotImplementedException(); - } - - - public static bool operator !=(Matrix matrix1, Matrix matrix2) - { - throw new NotImplementedException(); - } - - - public static Matrix operator *(Matrix matrix1, Matrix matrix2) - { - //--- - float[, ] arrayMatrix1 = new float[4, 4]; - float[, ] arrayMatrix2 = new float[4, 4]; - float[, ] arrayMatrixProduct = new float[4, 4]; - arrayMatrix1[0, 0] = matrix1.M11; arrayMatrix1[0, 1] = matrix1.M12; arrayMatrix1[0, 2] = matrix1.M13; arrayMatrix1[0, 3] = matrix1.M14; - arrayMatrix1[1, 0] = matrix1.M21; arrayMatrix1[1, 1] = matrix1.M22; arrayMatrix1[1, 2] = matrix1.M23; arrayMatrix1[1, 3] = matrix1.M24; - arrayMatrix1[2, 0] = matrix1.M31; arrayMatrix1[2, 1] = matrix1.M32; arrayMatrix1[2, 2] = matrix1.M33; arrayMatrix1[2, 3] = matrix1.M34; - arrayMatrix1[3, 0] = matrix1.M41; arrayMatrix1[3, 1] = matrix1.M42; arrayMatrix1[3, 2] = matrix1.M43; arrayMatrix1[3, 3] = matrix1.M44; - - arrayMatrix2[0, 0] = matrix2.M11; arrayMatrix2[0, 1] = matrix2.M12; arrayMatrix2[0, 2] = matrix2.M13; arrayMatrix2[0, 3] = matrix2.M14; - arrayMatrix2[1, 0] = matrix2.M21; arrayMatrix2[1, 1] = matrix2.M22; arrayMatrix2[1, 2] = matrix2.M23; arrayMatrix2[1, 3] = matrix2.M24; - arrayMatrix2[2, 0] = matrix2.M31; arrayMatrix2[2, 1] = matrix2.M32; arrayMatrix2[2, 2] = matrix2.M33; arrayMatrix2[2, 3] = matrix2.M34; - arrayMatrix2[3, 0] = matrix2.M41; arrayMatrix2[3, 1] = matrix2.M42; arrayMatrix2[3, 2] = matrix2.M43; arrayMatrix2[3, 3] = matrix2.M44; - - int n = 4; - for (int i = 0; i < n; i++) - { - for (int j = 0; j < n; j++) - { - // (AB)[i,j] = Sum(k=0; k < 4; k++) { A[i,k] * B[k, j] } - for (int k = 0; k < n; k++) - { - arrayMatrixProduct[i, j] += arrayMatrix1[i, k] * arrayMatrix2[k, j]; - } - } - } - return new Matrix( arrayMatrixProduct[0, 0], arrayMatrixProduct[0, 1], arrayMatrixProduct[0, 2], arrayMatrixProduct[0, 3], - arrayMatrixProduct[1, 0], arrayMatrixProduct[1, 1], arrayMatrixProduct[1, 2], arrayMatrixProduct[1, 3], - arrayMatrixProduct[2, 0], arrayMatrixProduct[2, 1], arrayMatrixProduct[2, 2], arrayMatrixProduct[2, 3], - arrayMatrixProduct[3, 1], arrayMatrixProduct[3, 1], arrayMatrixProduct[3, 2], arrayMatrixProduct[3, 3]); - //--- - //throw new NotImplementedException(); - } - - - public static Matrix operator *(Matrix matrix, float scaleFactor) - { - throw new NotImplementedException(); - } - - - public static Matrix operator -(Matrix matrix1, Matrix matrix2) - { - throw new NotImplementedException(); - } - - - public static Matrix operator -(Matrix matrix1) - { - throw new NotImplementedException(); - } - - - public static Matrix Subtract(Matrix matrix1, Matrix matrix2) - { - throw new NotImplementedException(); - } - - - public static void Subtract(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) - { - throw new NotImplementedException(); - } - - - public override string ToString() - { - return "[(" + this.M11 + ", " + this.M12 + ", " + this.M13 + ", " + this.M14 + ")\n (" - + this.M21 + ", " + this.M22 + ", " + this.M23 + ", " + this.M24 + ")\n (" - + this.M31 + ", " + this.M32 + ", " + this.M33 + ", " + this.M34 + ")\n (" - + this.M41 + ", " + this.M42 + ", " + this.M43 + ", " + this.M44 + ")]"; - } - - - public static Matrix Transpose(Matrix matrix) - { - //--- - return new Matrix( matrix.M11, matrix.M21, matrix.M31, matrix.M41, - matrix.M12, matrix.M22, matrix.M32, matrix.M42, - matrix.M13, matrix.M23, matrix.M33, matrix.M43, - matrix.M14, matrix.M24, matrix.M34, matrix.M44); - //--- - //throw new NotImplementedException(); - } - - - public static void Transpose(ref Matrix matrix, out Matrix result) - { - throw new NotImplementedException(); - } - #endregion Public Methods - } -} diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/MonoXnaCompactMaths.csproj b/libraries/ModifiedBulletX/MonoXnaCompactMaths/MonoXnaCompactMaths.csproj deleted file mode 100644 index 79c5263..0000000 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/MonoXnaCompactMaths.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {121147BC-B06B-406C-84E9-907F268CF0EB} - Library - Properties - MonoXnaCompactMaths - MonoXnaCompactMaths - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Properties/AssemblyInfo.cs b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Properties/AssemblyInfo.cs deleted file mode 100644 index 366f664..0000000 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// La información general sobre un ensamblado se controla mediante el siguiente -// conjunto de atributos. Cambie estos atributos para modificar la información -// asociada con un ensamblado. -[assembly: AssemblyTitle("MonoXnaCompactMaths")] -[assembly: AssemblyDescription("MonoXnaCompactMaths (Vector3, Vector4, Quaternion and Matrix)")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Copyright 2006 - 2007 The Mono.Xna Team")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Si establece ComVisible como false hace que los tipos de este ensamblado no sean visibles -// a los componentes COM. Si necesita obtener acceso a un tipo en este ensamblado desde -// COM, establezca el atributo ComVisible como true en este tipo. -[assembly: ComVisible(false)] - -// El siguiente GUID sirve como identificador de la biblioteca de tipos si este proyecto se expone a COM -[assembly: Guid("79f9dfd1-60f8-44b8-ab08-6f6e341976b7")] - -// La información de versión de un ensamblado consta de los cuatro valores siguientes: -// -// Versión principal -// Versión secundaria -// Número de versión de compilación -// Revisión -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs deleted file mode 100644 index b6d9d34..0000000 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs +++ /dev/null @@ -1,431 +0,0 @@ -#region License -/* -MIT License -Copyright © 2006 The Mono.Xna Team - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ -#endregion License - -using System; -using System.ComponentModel; - -namespace MonoXnaCompactMaths -{ - [Serializable] - //[TypeConverter(typeof(QuaternionConverter))] - public struct Quaternion : IEquatable - { - public float X; - public float Y; - public float Z; - public float W; - static Quaternion identity = new Quaternion(0, 0, 0, 1); - - - public Quaternion(float x, float y, float z, float w) - { - this.X = x; - this.Y = y; - this.Z = z; - this.W = w; - } - - - public Quaternion(Vector3 vectorPart, float scalarPart) - { - this.X = vectorPart.X; - this.Y = vectorPart.Y; - this.Z = vectorPart.Z; - this.W = scalarPart; - } - - public static Quaternion Identity - { - get{ return identity; } - } - - - public static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2) - { - throw new NotImplementedException(); - } - - - public static void Add(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle) - { - throw new NotImplementedException(); - } - - - public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public static Quaternion CreateFromRotationMatrix(Matrix matrix) - { - float Omega2 = matrix.M44; - if (!isAprox(Omega2, 1f)) - { - //"Normalize" the Rotation matrix. Norma = M44 = Omega2 - matrix = matrix / Omega2; - } - //Deducted from: public static Matrix CreateFromQuaternion(Quaternion quaternion) - float lambda1pos, lambda2pos, lambda3pos, lambda1neg, lambda2neg, lambda3neg; - lambda1pos = (1f - matrix.M11 + matrix.M23 + matrix.M32) / 2f; - lambda2pos = (1f - matrix.M22 + matrix.M13 + matrix.M31) / 2f; - lambda3pos = (1f - matrix.M33 + matrix.M12 + matrix.M21) / 2f; - lambda1neg = (1f - matrix.M11 - matrix.M23 - matrix.M32) / 2f; - lambda2neg = (1f - matrix.M22 - matrix.M13 - matrix.M31) / 2f; - lambda3neg = (1f - matrix.M33 - matrix.M12 - matrix.M21) / 2f; - - //lambadIS = (qJ + s*qK)^2 - //q0 = w | q1 = x | q2 = y, q3 = z - //Every value of qI (I=1,2,3) has 4 possible values cause the sqrt - float[] x = new float[4]; float[] y = new float[4]; float[] z = new float[4]; - float[] sig1 = {1f, 1f, -1f, -1f}; - float[] sig2 = {1f, -1f, 1f, -1f}; - for (int i = 0; i < 4; i++) - { - x[i] = (sig1[i] * (float)Math.Sqrt(lambda1pos) + sig2[i] * (float)Math.Sqrt(lambda1neg)) / 2f; - y[i] = (sig1[i] * (float)Math.Sqrt(lambda2pos) + sig2[i] * (float)Math.Sqrt(lambda2neg)) / 2f; - z[i] = (sig1[i] * (float)Math.Sqrt(lambda3pos) + sig2[i] * (float)Math.Sqrt(lambda3neg)) / 2f; - } - - //Only a set of x, y, z are the corrects values. So it requires testing - int li_i=0, li_j=0, li_k=0; - bool lb_testL1P, lb_testL2P, lb_testL3P, lb_testL1N, lb_testL2N, lb_testL3N; - bool lb_superLambda = false; - while((li_i<4)&&(!lb_superLambda)) - { - while ((li_j < 4) && (!lb_superLambda)) - { - while ((li_k < 4) && (!lb_superLambda)) - { - lb_testL1P = isAprox((float)( - Math.Pow((double)(y[li_j] + z[li_k]), 2.0)), lambda1pos); - lb_testL2P = isAprox((float)( - Math.Pow((double)(x[li_i] + z[li_k]), 2.0)), lambda2pos); - lb_testL3P = isAprox((float)( - Math.Pow((double)(x[li_i] + y[li_j]), 2.0)), lambda3pos); - lb_testL1N = isAprox((float)( - Math.Pow((double)(y[li_j] - z[li_k]), 2.0)), lambda1neg); - lb_testL2N = isAprox((float)( - Math.Pow((double)(x[li_i] - z[li_k]), 2.0)), lambda2neg); - lb_testL3N = isAprox((float)( - Math.Pow((double)(x[li_i] - y[li_j]), 2.0)), lambda3neg); - - lb_superLambda = (lb_testL1P && lb_testL2P && lb_testL3P - && lb_testL1N && lb_testL2N && lb_testL3N); - - if (!lb_superLambda) li_k++; - } - if (!lb_superLambda) li_j++; - } - if (!lb_superLambda) li_i++; - } - - Quaternion q = new Quaternion(); - - if (lb_superLambda) - { - q.X = x[li_i]; q.Y = y[li_j]; q.Z = z[li_k]; - q.W = (matrix.M12 - 2f * q.X * q.Y) / (2f * q.Z); - - if (!isAprox(Omega2, 1f)) - { - if (Omega2 < 0) throw new Exception("Quaternion.CreateFromRotationMatrix: Omega2 is negative!"); - q = q * (float)Math.Sqrt(Omega2);//2 possibles values (+/-). For now only 1. - } - } - else - { - q = Quaternion.identity; - } - - return q; - } - private static float floatError = 0.000001f; - private static bool isAprox(float test, float realValue) - { - return (((realValue * (1f - floatError)) <= test) && (test <= (realValue * (1f + floatError)))); - } - - - public static void CreateFromRotationMatrix(ref Matrix matrix, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2) - { - throw new NotImplementedException(); - } - - - public static void Divide(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public static float Dot(Quaternion quaternion1, Quaternion quaternion2) - { - throw new NotImplementedException(); - } - - - public static void Dot(ref Quaternion quaternion1, ref Quaternion quaternion2, out float result) - { - throw new NotImplementedException(); - } - - - public override bool Equals(object obj) - { - throw new NotImplementedException(); - } - - - public bool Equals(Quaternion other) - { - throw new NotImplementedException(); - } - - - public override int GetHashCode() - { - throw new NotImplementedException(); - } - - - public static Quaternion Inverse(Quaternion quaternion) - { - throw new NotImplementedException(); - } - - - public static void Inverse(ref Quaternion quaternion, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public float Length() - { - //--- - return (float)Math.Sqrt(Math.Pow(this.W, 2.0) + Math.Pow(this.X, 2.0) + Math.Pow(this.Y, 2.0) + Math.Pow(this.Z, 2.0)); - //--- - //throw new NotImplementedException(); - } - - - public float LengthSquared() - { - //--- - return (float)(Math.Pow(this.W, 2.0) + Math.Pow(this.X, 2.0) + Math.Pow(this.Y, 2.0) + Math.Pow(this.Z, 2.0)); - //--- - //throw new NotImplementedException(); - } - - - public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount) - { - throw new NotImplementedException(); - } - - - public static void Lerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount) - { - throw new NotImplementedException(); - } - - - public static void Slerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2) - { - throw new NotImplementedException(); - } - - - public static void Subtract(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2) - { - throw new NotImplementedException(); - } - - - public static Quaternion Multiply(Quaternion quaternion1, float scaleFactor) - { - throw new NotImplementedException(); - } - - - public static void Multiply(ref Quaternion quaternion1, float scaleFactor, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public static void Multiply(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public static Quaternion Negate(Quaternion quaternion) - { - throw new NotImplementedException(); - } - - - public static void Negate(ref Quaternion quaternion, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public void Normalize() - { - //--- - this = Normalize(this); - //--- - //throw new NotImplementedException(); - } - - - public static Quaternion Normalize(Quaternion quaternion) - { - //--- - return quaternion / quaternion.Length(); - //--- - //throw new NotImplementedException(); - } - - - public static void Normalize(ref Quaternion quaternion, out Quaternion result) - { - throw new NotImplementedException(); - } - - - public static Quaternion operator +(Quaternion quaternion1, Quaternion quaternion2) - { - throw new NotImplementedException(); - } - - - public static Quaternion operator /(Quaternion quaternion1, Quaternion quaternion2) - { - throw new NotImplementedException(); - } - public static Quaternion operator /(Quaternion quaternion, float factor) - { - quaternion.W /= factor; - quaternion.X /= factor; - quaternion.Y /= factor; - quaternion.Z /= factor; - return quaternion; - } - - public static bool operator ==(Quaternion quaternion1, Quaternion quaternion2) - { - throw new NotImplementedException(); - } - - - public static bool operator !=(Quaternion quaternion1, Quaternion quaternion2) - { - throw new NotImplementedException(); - } - - - public static Quaternion operator *(Quaternion quaternion1, Quaternion quaternion2) - { - //--- - //Grassmann product - Quaternion quaternionProduct = new Quaternion(); - - quaternionProduct.W = quaternion1.W * quaternion2.W - quaternion1.X * quaternion2.X - quaternion1.Y * quaternion2.Y - quaternion1.Z * quaternion2.Z; - quaternionProduct.X = quaternion1.W * quaternion2.X + quaternion1.X * quaternion2.W + quaternion1.Y * quaternion2.Z - quaternion1.Z * quaternion2.Y; - quaternionProduct.Y = quaternion1.W * quaternion2.Y - quaternion1.X * quaternion2.Z + quaternion1.Y * quaternion2.W + quaternion1.Z * quaternion2.X; - quaternionProduct.Z = quaternion1.W * quaternion2.Z + quaternion1.X * quaternion2.Y - quaternion1.Y * quaternion2.X + quaternion1.Z * quaternion2.W; - return quaternionProduct; - //--- - //throw new NotImplementedException(); - } - - - public static Quaternion operator *(Quaternion quaternion1, float scaleFactor) - { - return new Quaternion(quaternion1.X / scaleFactor, quaternion1.Y / scaleFactor, - quaternion1.Z / scaleFactor, quaternion1.W / scaleFactor); - } - - - public static Quaternion operator -(Quaternion quaternion1, Quaternion quaternion2) - { - throw new NotImplementedException(); - } - - - public static Quaternion operator -(Quaternion quaternion) - { - throw new NotImplementedException(); - } - - - public override string ToString() - { - return "(" + this.X + ", " + this.Y + ", " + this.Z + ", " + this.W + ")"; - } - - private static void Conjugate(ref Quaternion quaternion, out Quaternion result) - { - throw new NotImplementedException(); - } - } -} diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector3.cs b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector3.cs deleted file mode 100644 index f246415..0000000 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector3.cs +++ /dev/null @@ -1,620 +0,0 @@ -#region License -/* -MIT License -Copyright © 2006 The Mono.Xna Team - -All rights reserved. - -Authors: - * Alan McGovern - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ -#endregion License - -using System; -using System.ComponentModel; -using System.Text; -using System.Runtime.InteropServices; - -namespace MonoXnaCompactMaths -{ - [Serializable] - [StructLayout(LayoutKind.Sequential)] - //[TypeConverter(typeof(Vector3Converter))] - public struct Vector3 : IEquatable - { - #region Private Fields - - private static Vector3 zero = new Vector3(0f, 0f, 0f); - private static Vector3 one = new Vector3(1f, 1f, 1f); - private static Vector3 unitX = new Vector3(1f, 0f, 0f); - private static Vector3 unitY = new Vector3(0f, 1f, 0f); - private static Vector3 unitZ = new Vector3(0f, 0f, 1f); - private static Vector3 up = new Vector3(0f, 1f, 0f); - private static Vector3 down = new Vector3(0f, -1f, 0f); - private static Vector3 right = new Vector3(1f, 0f, 0f); - private static Vector3 left = new Vector3(-1f, 0f, 0f); - private static Vector3 forward = new Vector3(0f, 0f, -1f); - private static Vector3 backward = new Vector3(0f, 0f, 1f); - - #endregion Private Fields - - - #region Public Fields - - public float X; - public float Y; - public float Z; - - #endregion Public Fields - - - #region Properties - - public static Vector3 Zero - { - get { return zero; } - } - - public static Vector3 One - { - get { return one; } - } - - public static Vector3 UnitX - { - get { return unitX; } - } - - public static Vector3 UnitY - { - get { return unitY; } - } - - public static Vector3 UnitZ - { - get { return unitZ; } - } - - public static Vector3 Up - { - get { return up; } - } - - public static Vector3 Down - { - get { return down; } - } - - public static Vector3 Right - { - get { return right; } - } - - public static Vector3 Left - { - get { return left; } - } - - public static Vector3 Forward - { - get { return forward; } - } - - public static Vector3 Backward - { - get { return backward; } - } - - #endregion Properties - - - #region Constructors - - public Vector3(float x, float y, float z) - { - this.X = x; - this.Y = y; - this.Z = z; - } - - - public Vector3(float value) - { - this.X = value; - this.Y = value; - this.Z = value; - } - - - /*public Vector3(Vector2 value, float z) - { - this.X = value.X; - this.Y = value.Y; - this.Z = z; - }*/ - - - #endregion Constructors - - - #region Public Methods - - public static Vector3 Add(Vector3 value1, Vector3 value2) - { - value1.X += value2.X; - value1.Y += value2.Y; - value1.Z += value2.Z; - return value1; - } - - public static void Add(ref Vector3 value1, ref Vector3 value2, out Vector3 result) - { - result.X = value1.X + value2.X; - result.Y = value1.Y + value2.Y; - result.Z = value1.Z + value2.Z; - } - - /*public static Vector3 Barycentric(Vector3 value1, Vector3 value2, Vector3 value3, float amount1, float amount2) - { - return new Vector3( - MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), - MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), - MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2)); - }*/ - - /*public static void Barycentric(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, float amount1, float amount2, out Vector3 result) - { - result = new Vector3( - MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), - MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), - MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2)); - }*/ - - /*public static Vector3 CatmullRom(Vector3 value1, Vector3 value2, Vector3 value3, Vector3 value4, float amount) - { - return new Vector3( - MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), - MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), - MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount)); - }*/ - - /*public static void CatmullRom(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, ref Vector3 value4, float amount, out Vector3 result) - { - result = new Vector3( - MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), - MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), - MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount)); - }*/ - - /*public static Vector3 Clamp(Vector3 value1, Vector3 min, Vector3 max) - { - return new Vector3( - MathHelper.Clamp(value1.X, min.X, max.X), - MathHelper.Clamp(value1.Y, min.Y, max.Y), - MathHelper.Clamp(value1.Z, min.Z, max.Z)); - }*/ - - /*public static void Clamp(ref Vector3 value1, ref Vector3 min, ref Vector3 max, out Vector3 result) - { - result = new Vector3( - MathHelper.Clamp(value1.X, min.X, max.X), - MathHelper.Clamp(value1.Y, min.Y, max.Y), - MathHelper.Clamp(value1.Z, min.Z, max.Z)); - }*/ - - public static Vector3 Cross(Vector3 vector1, Vector3 vector2) - { - Cross(ref vector1, ref vector2, out vector1); - return vector1; - } - - public static void Cross(ref Vector3 vector1, ref Vector3 vector2, out Vector3 result) - { - result = new Vector3(vector1.Y * vector2.Z - vector2.Y * vector1.Z, - -(vector1.X * vector2.Z - vector2.X * vector1.Z), - vector1.X * vector2.Y - vector2.X * vector1.Y); - } - - public static float Distance(Vector3 vector1, Vector3 vector2) - { - float result; - DistanceSquared(ref vector1, ref vector2, out result); - return (float)Math.Sqrt(result); - } - - public static void Distance(ref Vector3 value1, ref Vector3 value2, out float result) - { - DistanceSquared(ref value1, ref value2, out result); - result = (float)Math.Sqrt(result); - } - - public static float DistanceSquared(Vector3 value1, Vector3 value2) - { - float result; - DistanceSquared(ref value1, ref value2, out result); - return result; - } - - public static void DistanceSquared(ref Vector3 value1, ref Vector3 value2, out float result) - { - result = (value1.X - value2.X) * (value1.X - value2.X) + - (value1.Y - value2.Y) * (value1.Y - value2.Y) + - (value1.Z - value2.Z) * (value1.Z - value2.Z); - } - - public static Vector3 Divide(Vector3 value1, Vector3 value2) - { - value1.X /= value2.X; - value1.Y /= value2.Y; - value1.Z /= value2.Z; - return value1; - } - - public static Vector3 Divide(Vector3 value1, float value2) - { - float factor = 1 / value2; - value1.X *= factor; - value1.Y *= factor; - value1.Z *= factor; - return value1; - } - - public static void Divide(ref Vector3 value1, float divisor, out Vector3 result) - { - float factor = 1 / divisor; - result.X = value1.X * factor; - result.Y = value1.Y * factor; - result.Z = value1.Z * factor; - } - - public static void Divide(ref Vector3 value1, ref Vector3 value2, out Vector3 result) - { - result.X = value1.X / value2.X; - result.Y = value1.Y / value2.Y; - result.Z = value1.Z / value2.Z; - } - - public static float Dot(Vector3 vector1, Vector3 vector2) - { - return vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z; - } - - public static void Dot(ref Vector3 vector1, ref Vector3 vector2, out float result) - { - result = vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z; - } - - public override bool Equals(object obj) - { - return (obj is Vector3) ? this == (Vector3)obj : false; - } - - public bool Equals(Vector3 other) - { - return this == other; - } - - public override int GetHashCode() - { - return (int)(this.X + this.Y + this.Z); - } - - /*public static Vector3 Hermite(Vector3 value1, Vector3 tangent1, Vector3 value2, Vector3 tangent2, float amount) - { - Vector3 result = new Vector3(); - Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result); - return result; - }*/ - - /*public static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result) - { - result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount); - result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount); - result.Z = MathHelper.Hermite(value1.Z, tangent1.Z, value2.Z, tangent2.Z, amount); - }*/ - - public float Length() - { - float result; - DistanceSquared(ref this, ref zero, out result); - return (float)Math.Sqrt(result); - } - - public float LengthSquared() - { - float result; - DistanceSquared(ref this, ref zero, out result); - return result; - } - - /*public static Vector3 Lerp(Vector3 value1, Vector3 value2, float amount) - { - return new Vector3( - MathHelper.Lerp(value1.X, value2.X, amount), - MathHelper.Lerp(value1.Y, value2.Y, amount), - MathHelper.Lerp(value1.Z, value2.Z, amount)); - }*/ - - /*public static void Lerp(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result) - { - result = new Vector3( - MathHelper.Lerp(value1.X, value2.X, amount), - MathHelper.Lerp(value1.Y, value2.Y, amount), - MathHelper.Lerp(value1.Z, value2.Z, amount)); - }*/ - - /*public static Vector3 Max(Vector3 value1, Vector3 value2) - { - return new Vector3( - MathHelper.Max(value1.X, value2.X), - MathHelper.Max(value1.Y, value2.Y), - MathHelper.Max(value1.Z, value2.Z)); - }*/ - - /*public static void Max(ref Vector3 value1, ref Vector3 value2, out Vector3 result) - { - result = new Vector3( - MathHelper.Max(value1.X, value2.X), - MathHelper.Max(value1.Y, value2.Y), - MathHelper.Max(value1.Z, value2.Z)); - }*/ - - /*public static Vector3 Min(Vector3 value1, Vector3 value2) - { - return new Vector3( - MathHelper.Min(value1.X, value2.X), - MathHelper.Min(value1.Y, value2.Y), - MathHelper.Min(value1.Z, value2.Z)); - }*/ - - /*public static void Min(ref Vector3 value1, ref Vector3 value2, out Vector3 result) - { - result = new Vector3( - MathHelper.Min(value1.X, value2.X), - MathHelper.Min(value1.Y, value2.Y), - MathHelper.Min(value1.Z, value2.Z)); - }*/ - - public static Vector3 Multiply(Vector3 value1, Vector3 value2) - { - value1.X *= value2.X; - value1.Y *= value2.Y; - value1.Z *= value2.Z; - return value1; - } - - public static Vector3 Multiply(Vector3 value1, float scaleFactor) - { - value1.X *= scaleFactor; - value1.Y *= scaleFactor; - value1.Z *= scaleFactor; - return value1; - } - - public static void Multiply(ref Vector3 value1, float scaleFactor, out Vector3 result) - { - result.X = value1.X * scaleFactor; - result.Y = value1.Y * scaleFactor; - result.Z = value1.Z * scaleFactor; - } - - public static void Multiply(ref Vector3 value1, ref Vector3 value2, out Vector3 result) - { - result.X = value1.X * value2.X; - result.Y = value1.Y * value2.Y; - result.Z = value1.Z * value2.Z; - } - - public static Vector3 Negate(Vector3 value) - { - value = new Vector3(-value.X, -value.Y, -value.Z); - return value; - } - - public static void Negate(ref Vector3 value, out Vector3 result) - { - result = new Vector3(-value.X, -value.Y, -value.Z); - } - - public void Normalize() - { - Normalize(ref this, out this); - } - - public static Vector3 Normalize(Vector3 vector) - { - Normalize(ref vector, out vector); - return vector; - } - - public static void Normalize(ref Vector3 value, out Vector3 result) - { - float factor; - Distance(ref value, ref zero, out factor); - factor = 1f / factor; - result.X = value.X * factor; - result.Y = value.Y * factor; - result.Z = value.Z * factor; - } - - public static Vector3 Reflect(Vector3 vector, Vector3 normal) - { - throw new NotImplementedException(); - } - - public static void Reflect(ref Vector3 vector, ref Vector3 normal, out Vector3 result) - { - throw new NotImplementedException(); - } - - /*public static Vector3 SmoothStep(Vector3 value1, Vector3 value2, float amount) - { - return new Vector3( - MathHelper.SmoothStep(value1.X, value2.X, amount), - MathHelper.SmoothStep(value1.Y, value2.Y, amount), - MathHelper.SmoothStep(value1.Z, value2.Z, amount)); - }*/ - - /*public static void SmoothStep(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result) - { - result = new Vector3( - MathHelper.SmoothStep(value1.X, value2.X, amount), - MathHelper.SmoothStep(value1.Y, value2.Y, amount), - MathHelper.SmoothStep(value1.Z, value2.Z, amount)); - }*/ - - public static Vector3 Subtract(Vector3 value1, Vector3 value2) - { - value1.X -= value2.X; - value1.Y -= value2.Y; - value1.Z -= value2.Z; - return value1; - } - - public static void Subtract(ref Vector3 value1, ref Vector3 value2, out Vector3 result) - { - result.X = value1.X - value2.X; - result.Y = value1.Y - value2.Y; - result.Z = value1.Z - value2.Z; - } - - public override string ToString() - { - StringBuilder sb = new StringBuilder(32); - sb.Append("{X:"); - sb.Append(this.X); - sb.Append(" Y:"); - sb.Append(this.Y); - sb.Append(" Z:"); - sb.Append(this.Z); - sb.Append("}"); - return sb.ToString(); - } - - public static Vector3 Transform(Vector3 position, Matrix matrix) - { - Transform(ref position, ref matrix, out position); - return position; - } - - public static void Transform(ref Vector3 position, ref Matrix matrix, out Vector3 result) - { - result = new Vector3((position.X * matrix.M11) + (position.Y * matrix.M21) + (position.Z * matrix.M31) + matrix.M41, - (position.X * matrix.M12) + (position.Y * matrix.M22) + (position.Z * matrix.M32) + matrix.M42, - (position.X * matrix.M13) + (position.Y * matrix.M23) + (position.Z * matrix.M33) + matrix.M43); - } - - public static Vector3 TransformNormal(Vector3 normal, Matrix matrix) - { - TransformNormal(ref normal, ref matrix, out normal); - return normal; - } - - public static void TransformNormal(ref Vector3 normal, ref Matrix matrix, out Vector3 result) - { - result = new Vector3((normal.X * matrix.M11) + (normal.Y * matrix.M21) + (normal.Z * matrix.M31), - (normal.X * matrix.M12) + (normal.Y * matrix.M22) + (normal.Z * matrix.M32), - (normal.X * matrix.M13) + (normal.Y * matrix.M23) + (normal.Z * matrix.M33)); - } - - #endregion Public methods - - - #region Operators - - public static bool operator ==(Vector3 value1, Vector3 value2) - { - return value1.X == value2.X - && value1.Y == value2.Y - && value1.Z == value2.Z; - } - - public static bool operator !=(Vector3 value1, Vector3 value2) - { - return !(value1 == value2); - } - - public static Vector3 operator +(Vector3 value1, Vector3 value2) - { - value1.X += value2.X; - value1.Y += value2.Y; - value1.Z += value2.Z; - return value1; - } - - public static Vector3 operator -(Vector3 value) - { - value = new Vector3(-value.X, -value.Y, -value.Z); - return value; - } - - public static Vector3 operator -(Vector3 value1, Vector3 value2) - { - value1.X -= value2.X; - value1.Y -= value2.Y; - value1.Z -= value2.Z; - return value1; - } - - public static Vector3 operator *(Vector3 value1, Vector3 value2) - { - value1.X *= value2.X; - value1.Y *= value2.Y; - value1.Z *= value2.Z; - return value1; - } - - public static Vector3 operator *(Vector3 value, float scaleFactor) - { - value.X *= scaleFactor; - value.Y *= scaleFactor; - value.Z *= scaleFactor; - return value; - } - - public static Vector3 operator *(float scaleFactor, Vector3 value) - { - value.X *= scaleFactor; - value.Y *= scaleFactor; - value.Z *= scaleFactor; - return value; - } - - public static Vector3 operator /(Vector3 value1, Vector3 value2) - { - value1.X /= value2.X; - value1.Y /= value2.Y; - value1.Z /= value2.Z; - return value1; - } - - public static Vector3 operator /(Vector3 value, float divider) - { - float factor = 1 / divider; - value.X *= factor; - value.Y *= factor; - value.Z *= factor; - return value; - } - - #endregion - } -} diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector4.cs b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector4.cs deleted file mode 100644 index abb30a8..0000000 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector4.cs +++ /dev/null @@ -1,630 +0,0 @@ -#region License -/* -MIT License -Copyright © 2006 The Mono.Xna Team - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ -#endregion License - -using System; -using System.ComponentModel; -using System.Text; -using System.Runtime.InteropServices; - -namespace MonoXnaCompactMaths -{ - [Serializable] - [StructLayout(LayoutKind.Sequential)] - //[TypeConverter(typeof(Vector4Converter))] - public struct Vector4 : IEquatable - { - #region Private Fields - - private static Vector4 zeroVector = new Vector4(); - private static Vector4 unitVector = new Vector4(1f, 1f, 1f, 1f); - private static Vector4 unitXVector = new Vector4(1f, 0f, 0f, 0f); - private static Vector4 unitYVector = new Vector4(0f, 1f, 0f, 0f); - private static Vector4 unitZVector = new Vector4(0f, 0f, 1f, 0f); - private static Vector4 unitWVector = new Vector4(0f, 0f, 0f, 1f); - - #endregion Private Fields - - - #region Public Fields - - public float X; - public float Y; - public float Z; - public float W; - - #endregion Public Fields - - - #region Properties - - public static Vector4 Zero - { - get { return zeroVector; } - } - - public static Vector4 One - { - get { return unitVector; } - } - - public static Vector4 UnitX - { - get { return unitXVector; } - } - - public static Vector4 UnitY - { - get { return unitYVector; } - } - - public static Vector4 UnitZ - { - get { return unitZVector; } - } - - public static Vector4 UnitW - { - get { return unitWVector; } - } - - #endregion Properties - - - #region Constructors - - public Vector4(float x, float y, float z, float w) - { - this.X = x; - this.Y = y; - this.Z = z; - this.W = w; - } - - /*public Vector4(Vector2 value, float z, float w) - { - this.X = value.X; - this.Y = value.Y; - this.Z = z; - this.W = w; - }*/ - - public Vector4(Vector3 value, float w) - { - this.X = value.X; - this.Y = value.Y; - this.Z = value.Z; - this.W = w; - } - - public Vector4(float value) - { - this.X = value; - this.Y = value; - this.Z = value; - this.W = value; - } - - #endregion - - - #region Public Methods - - public static Vector4 Add(Vector4 value1, Vector4 value2) - { - value1.W += value2.W; - value1.X += value2.X; - value1.Y += value2.Y; - value1.Z += value2.Z; - return value1; - } - - public static void Add(ref Vector4 value1, ref Vector4 value2, out Vector4 result) - { - result.W = value1.W + value2.W; - result.X = value1.X + value2.X; - result.Y = value1.Y + value2.Y; - result.Z = value1.Z + value2.Z; - } - - /*public static Vector4 Barycentric(Vector4 value1, Vector4 value2, Vector4 value3, float amount1, float amount2) - { - return new Vector4( - MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), - MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), - MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2), - MathHelper.Barycentric(value1.W, value2.W, value3.W, amount1, amount2)); - }*/ - - /*public static void Barycentric(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, float amount1, float amount2, out Vector4 result) - { - result = new Vector4( - MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), - MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), - MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2), - MathHelper.Barycentric(value1.W, value2.W, value3.W, amount1, amount2)); - }*/ - - /*public static Vector4 CatmullRom(Vector4 value1, Vector4 value2, Vector4 value3, Vector4 value4, float amount) - { - return new Vector4( - MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), - MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), - MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount), - MathHelper.CatmullRom(value1.W, value2.W, value3.W, value4.W, amount)); - }*/ - - /*public static void CatmullRom(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, ref Vector4 value4, float amount, out Vector4 result) - { - result = new Vector4( - MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), - MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), - MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount), - MathHelper.CatmullRom(value1.W, value2.W, value3.W, value4.W, amount)); - }*/ - - /*public static Vector4 Clamp(Vector4 value1, Vector4 min, Vector4 max) - { - return new Vector4( - MathHelper.Clamp(value1.X, min.X, max.X), - MathHelper.Clamp(value1.Y, min.Y, max.Y), - MathHelper.Clamp(value1.Z, min.Z, max.Z), - MathHelper.Clamp(value1.W, min.W, max.W)); - }*/ - - /*public static void Clamp(ref Vector4 value1, ref Vector4 min, ref Vector4 max, out Vector4 result) - { - result = new Vector4( - MathHelper.Clamp(value1.X, min.X, max.X), - MathHelper.Clamp(value1.Y, min.Y, max.Y), - MathHelper.Clamp(value1.Z, min.Z, max.Z), - MathHelper.Clamp(value1.W, min.W, max.W)); - }*/ - - public static float Distance(Vector4 value1, Vector4 value2) - { - return (float)Math.Sqrt(DistanceSquared(value1, value2)); - } - - public static void Distance(ref Vector4 value1, ref Vector4 value2, out float result) - { - result = (float)Math.Sqrt(DistanceSquared(value1, value2)); - } - - public static float DistanceSquared(Vector4 value1, Vector4 value2) - { - float result; - DistanceSquared(ref value1, ref value2, out result); - return result; - } - - public static void DistanceSquared(ref Vector4 value1, ref Vector4 value2, out float result) - { - result = (value1.W - value2.W) * (value1.W - value2.W) + - (value1.X - value2.X) * (value1.X - value2.X) + - (value1.Y - value2.Y) * (value1.Y - value2.Y) + - (value1.Z - value2.Z) * (value1.Z - value2.Z); - } - - public static Vector4 Divide(Vector4 value1, Vector4 value2) - { - value1.W /= value2.W; - value1.X /= value2.X; - value1.Y /= value2.Y; - value1.Z /= value2.Z; - return value1; - } - - public static Vector4 Divide(Vector4 value1, float divider) - { - float factor = 1f / divider; - value1.W *= factor; - value1.X *= factor; - value1.Y *= factor; - value1.Z *= factor; - return value1; - } - - public static void Divide(ref Vector4 value1, float divider, out Vector4 result) - { - float factor = 1f / divider; - result.W = value1.W * factor; - result.X = value1.X * factor; - result.Y = value1.Y * factor; - result.Z = value1.Z * factor; - } - - public static void Divide(ref Vector4 value1, ref Vector4 value2, out Vector4 result) - { - result.W = value1.W / value2.W; - result.X = value1.X / value2.X; - result.Y = value1.Y / value2.Y; - result.Z = value1.Z / value2.Z; - } - - public static float Dot(Vector4 vector1, Vector4 vector2) - { - return vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z + vector1.W * vector2.W; - } - - public static void Dot(ref Vector4 vector1, ref Vector4 vector2, out float result) - { - result = vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z + vector1.W * vector2.W; - } - - public override bool Equals(object obj) - { - return (obj is Vector4) ? this == (Vector4)obj : false; - } - - public bool Equals(Vector4 other) - { - return this.W == other.W - && this.X == other.X - && this.Y == other.Y - && this.Z == other.Z; - } - - public override int GetHashCode() - { - return (int)(this.W + this.X + this.Y + this.Y); - } - - /*public static Vector4 Hermite(Vector4 value1, Vector4 tangent1, Vector4 value2, Vector4 tangent2, float amount) - { - Vector4 result = new Vector4(); - Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result); - return result; - }*/ - - /*public static void Hermite(ref Vector4 value1, ref Vector4 tangent1, ref Vector4 value2, ref Vector4 tangent2, float amount, out Vector4 result) - { - result.W = MathHelper.Hermite(value1.W, tangent1.W, value2.W, tangent2.W, amount); - result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount); - result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount); - result.Z = MathHelper.Hermite(value1.Z, tangent1.Z, value2.Z, tangent2.Z, amount); - }*/ - - public float Length() - { - float result; - DistanceSquared(ref this, ref zeroVector, out result); - return (float)Math.Sqrt(result); - } - - public float LengthSquared() - { - float result; - DistanceSquared(ref this, ref zeroVector, out result); - return result; - } - - /*public static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount) - { - return new Vector4( - MathHelper.Lerp(value1.X, value2.X, amount), - MathHelper.Lerp(value1.Y, value2.Y, amount), - MathHelper.Lerp(value1.Z, value2.Z, amount), - MathHelper.Lerp(value1.W, value2.W, amount)); - }*/ - - /*public static void Lerp(ref Vector4 value1, ref Vector4 value2, float amount, out Vector4 result) - { - result = new Vector4( - MathHelper.Lerp(value1.X, value2.X, amount), - MathHelper.Lerp(value1.Y, value2.Y, amount), - MathHelper.Lerp(value1.Z, value2.Z, amount), - MathHelper.Lerp(value1.W, value2.W, amount)); - }*/ - - /*public static Vector4 Max(Vector4 value1, Vector4 value2) - { - return new Vector4( - MathHelper.Max(value1.X, value2.X), - MathHelper.Max(value1.Y, value2.Y), - MathHelper.Max(value1.Z, value2.Z), - MathHelper.Max(value1.W, value2.W)); - }*/ - - /*public static void Max(ref Vector4 value1, ref Vector4 value2, out Vector4 result) - { - result = new Vector4( - MathHelper.Max(value1.X, value2.X), - MathHelper.Max(value1.Y, value2.Y), - MathHelper.Max(value1.Z, value2.Z), - MathHelper.Max(value1.W, value2.W)); - }*/ - - /*public static Vector4 Min(Vector4 value1, Vector4 value2) - { - return new Vector4( - MathHelper.Min(value1.X, value2.X), - MathHelper.Min(value1.Y, value2.Y), - MathHelper.Min(value1.Z, value2.Z), - MathHelper.Min(value1.W, value2.W)); - }*/ - - /*public static void Min(ref Vector4 value1, ref Vector4 value2, out Vector4 result) - { - result = new Vector4( - MathHelper.Min(value1.X, value2.X), - MathHelper.Min(value1.Y, value2.Y), - MathHelper.Min(value1.Z, value2.Z), - MathHelper.Min(value1.W, value2.W)); - }*/ - - public static Vector4 Multiply(Vector4 value1, Vector4 value2) - { - value1.W *= value2.W; - value1.X *= value2.X; - value1.Y *= value2.Y; - value1.Z *= value2.Z; - return value1; - } - - public static Vector4 Multiply(Vector4 value1, float scaleFactor) - { - value1.W *= scaleFactor; - value1.X *= scaleFactor; - value1.Y *= scaleFactor; - value1.Z *= scaleFactor; - return value1; - } - - public static void Multiply(ref Vector4 value1, float scaleFactor, out Vector4 result) - { - result.W = value1.W * scaleFactor; - result.X = value1.X * scaleFactor; - result.Y = value1.Y * scaleFactor; - result.Z = value1.Z * scaleFactor; - } - - public static void Multiply(ref Vector4 value1, ref Vector4 value2, out Vector4 result) - { - result.W = value1.W * value2.W; - result.X = value1.X * value2.X; - result.Y = value1.Y * value2.Y; - result.Z = value1.Z * value2.Z; - } - - public static Vector4 Negate(Vector4 value) - { - value = new Vector4(-value.X, -value.Y, -value.Z, -value.W); - return value; - } - - public static void Negate(ref Vector4 value, out Vector4 result) - { - result = new Vector4(-value.X, -value.Y, -value.Z,-value.W); - } - - public void Normalize() - { - Normalize(ref this, out this); - } - - public static Vector4 Normalize(Vector4 vector) - { - Normalize(ref vector, out vector); - return vector; - } - - public static void Normalize(ref Vector4 vector, out Vector4 result) - { - float factor; - DistanceSquared(ref vector, ref zeroVector, out factor); - factor = 1f / (float)Math.Sqrt(factor); - - result.W = vector.W * factor; - result.X = vector.X * factor; - result.Y = vector.Y * factor; - result.Z = vector.Z * factor; - } - - /*public static Vector4 SmoothStep(Vector4 value1, Vector4 value2, float amount) - { - return new Vector4( - MathHelper.SmoothStep(value1.X, value2.X, amount), - MathHelper.SmoothStep(value1.Y, value2.Y, amount), - MathHelper.SmoothStep(value1.Z, value2.Z, amount), - MathHelper.SmoothStep(value1.W, value2.W, amount)); - }*/ - - /*public static void SmoothStep(ref Vector4 value1, ref Vector4 value2, float amount, out Vector4 result) - { - result = new Vector4( - MathHelper.SmoothStep(value1.X, value2.X, amount), - MathHelper.SmoothStep(value1.Y, value2.Y, amount), - MathHelper.SmoothStep(value1.Z, value2.Z, amount), - MathHelper.SmoothStep(value1.W, value2.W, amount)); - }*/ - - public static Vector4 Subtract(Vector4 value1, Vector4 value2) - { - value1.W -= value2.W; - value1.X -= value2.X; - value1.Y -= value2.Y; - value1.Z -= value2.Z; - return value1; - } - - public static void Subtract(ref Vector4 value1, ref Vector4 value2, out Vector4 result) - { - result.W = value1.W - value2.W; - result.X = value1.X - value2.X; - result.Y = value1.Y - value2.Y; - result.Z = value1.Z - value2.Z; - } - - /*public static Vector4 Transform(Vector2 position, Matrix matrix) - { - Vector4 result; - Transform(ref position, ref matrix, out result); - return result; - }*/ - - public static Vector4 Transform(Vector3 position, Matrix matrix) - { - Vector4 result; - Transform(ref position, ref matrix, out result); - return result; - } - - public static Vector4 Transform(Vector4 vector, Matrix matrix) - { - Transform(ref vector, ref matrix, out vector); - return vector; - } - - /*public static void Transform(ref Vector2 position, ref Matrix matrix, out Vector4 result) - { - result = new Vector4((position.X * matrix.M11) + (position.Y * matrix.M21) + matrix.M41, - (position.X * matrix.M12) + (position.Y * matrix.M22) + matrix.M42, - (position.X * matrix.M13) + (position.Y * matrix.M23) + matrix.M43, - (position.X * matrix.M14) + (position.Y * matrix.M24) + matrix.M44); - }*/ - - public static void Transform(ref Vector3 position, ref Matrix matrix, out Vector4 result) - { - result = new Vector4((position.X * matrix.M11) + (position.Y * matrix.M21) + (position.Z * matrix.M31) + matrix.M41, - (position.X * matrix.M12) + (position.Y * matrix.M22) + (position.Z * matrix.M32) + matrix.M42, - (position.X * matrix.M13) + (position.Y * matrix.M23) + (position.Z * matrix.M33) + matrix.M43, - (position.X * matrix.M14) + (position.Y * matrix.M24) + (position.Z * matrix.M34) + matrix.M44); - } - - public static void Transform(ref Vector4 vector, ref Matrix matrix, out Vector4 result) - { - result = new Vector4((vector.X * matrix.M11) + (vector.Y * matrix.M21) + (vector.Z * matrix.M31) + (vector.W * matrix.M41), - (vector.X * matrix.M12) + (vector.Y * matrix.M22) + (vector.Z * matrix.M32) + (vector.W * matrix.M42), - (vector.X * matrix.M13) + (vector.Y * matrix.M23) + (vector.Z * matrix.M33) + (vector.W * matrix.M43), - (vector.X * matrix.M14) + (vector.Y * matrix.M24) + (vector.Z * matrix.M34) + (vector.W * matrix.M44)); - } - - public override string ToString() - { - StringBuilder sb = new StringBuilder(32); - sb.Append("{X:"); - sb.Append(this.X); - sb.Append(" Y:"); - sb.Append(this.Y); - sb.Append(" Z:"); - sb.Append(this.Z); - sb.Append(" W:"); - sb.Append(this.W); - sb.Append("}"); - return sb.ToString(); - } - - #endregion Public Methods - - - #region Operators - - public static Vector4 operator -(Vector4 value) - { - return new Vector4(-value.X, -value.Y, -value.Z, -value.W); - } - - public static bool operator ==(Vector4 value1, Vector4 value2) - { - return value1.W == value2.W - && value1.X == value2.X - && value1.Y == value2.Y - && value1.Z == value2.Z; - } - - public static bool operator !=(Vector4 value1, Vector4 value2) - { - return !(value1 == value2); - } - - public static Vector4 operator +(Vector4 value1, Vector4 value2) - { - value1.W += value2.W; - value1.X += value2.X; - value1.Y += value2.Y; - value1.Z += value2.Z; - return value1; - } - - public static Vector4 operator -(Vector4 value1, Vector4 value2) - { - value1.W -= value2.W; - value1.X -= value2.X; - value1.Y -= value2.Y; - value1.Z -= value2.Z; - return value1; - } - - public static Vector4 operator *(Vector4 value1, Vector4 value2) - { - value1.W *= value2.W; - value1.X *= value2.X; - value1.Y *= value2.Y; - value1.Z *= value2.Z; - return value1; - } - - public static Vector4 operator *(Vector4 value1, float scaleFactor) - { - value1.W *= scaleFactor; - value1.X *= scaleFactor; - value1.Y *= scaleFactor; - value1.Z *= scaleFactor; - return value1; - } - - public static Vector4 operator *(float scaleFactor, Vector4 value1) - { - value1.W *= scaleFactor; - value1.X *= scaleFactor; - value1.Y *= scaleFactor; - value1.Z *= scaleFactor; - return value1; - } - - public static Vector4 operator /(Vector4 value1, Vector4 value2) - { - value1.W /= value2.W; - value1.X /= value2.X; - value1.Y /= value2.Y; - value1.Z /= value2.Z; - return value1; - } - - public static Vector4 operator /(Vector4 value1, float divider) - { - float factor = 1f / divider; - value1.W *= factor; - value1.X *= factor; - value1.Y *= factor; - value1.Z *= factor; - return value1; - } - - #endregion Operators - } -} -- cgit v1.1