Fix tabs/spaces and righthandtransform caused by #331

This commit is contained in:
cra0zy 2016-02-20 20:55:15 +01:00
parent 4c8a3598e1
commit 3d58a0b50a
2 changed files with 122 additions and 120 deletions

View file

@ -25,6 +25,7 @@ SOFTWARE.
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace OpenTK namespace OpenTK
{ {
/// <summary> /// <summary>
@ -1191,49 +1192,49 @@ namespace OpenTK
Vector3.Add(ref vec, ref temp, out result); Vector3.Add(ref vec, ref temp, out result);
} }
/// <summary>Transform a Vector by the given Matrix using right-handed notation</summary> /// <summary>Transform a Vector by the given Matrix using right-handed notation</summary>
/// <param name="vec">The vector to transform</param> /// <param name="mat">The desired transformation</param>
/// <param name="mat">The desired transformation</param> /// <param name="vec">The vector to transform</param>
public static Vector3 RightHandedTransform(Vector3 vec, Matrix3 mat) public static Vector3 Transform(Matrix3 mat, Vector3 vec)
{ {
Vector3 result; Vector3 result;
RightHandedTransform(ref vec, ref mat, out result); Transform(ref vec, ref mat, out result);
return result; return result;
} }
/// <summary>Transform a Vector by the given Matrix using right-handed notation</summary> /// <summary>Transform a Vector by the given Matrix using right-handed notation</summary>
/// <param name="vec">The vector to transform</param> /// <param name="mat">The desired transformation</param>
/// <param name="mat">The desired transformation</param> /// <param name="vec">The vector to transform</param>
/// <param name="result">The transformed vector</param> /// <param name="result">The transformed vector</param>
public static void RightHandedTransform(ref Vector3 vec, ref Matrix3 mat, out Vector3 result) public static void Transform(ref Matrix3 mat, ref Vector3 vec, out Vector3 result)
{ {
result = new Vector3( result = new Vector3(
mat.Row0.X * vec.X + mat.Row0.Y * vec.Y + mat.Row0.Z * vec.Z, mat.Row0.X * vec.X + mat.Row0.Y * vec.Y + mat.Row0.Z * vec.Z,
mat.Row1.X * vec.X + mat.Row1.Y * vec.Y + mat.Row1.Z * vec.Z, mat.Row1.X * vec.X + mat.Row1.Y * vec.Y + mat.Row1.Z * vec.Z,
mat.Row2.X * vec.X + mat.Row2.Y * vec.Y + mat.Row2.Z * vec.Z); mat.Row2.X * vec.X + mat.Row2.Y * vec.Y + mat.Row2.Z * vec.Z);
} }
/// <summary>Transform a Vector by the given Matrix using right-handed notation</summary> /// <summary>Transform a Vector by the given Matrix using right-handed notation</summary>
/// <param name="vec">The vector to transform</param> /// <param name="mat">The desired transformation</param>
/// <param name="mat">The desired transformation</param> /// <param name="vec">The vector to transform</param>
public static Vector3 RightHandedTransform(Vector3 vec, Matrix4 mat) public static Vector3 Transform(Matrix4 mat, Vector3 vec)
{ {
Vector3 result; Vector3 result;
RightHandedTransform(ref vec, ref mat, out result); Transform(ref mat, ref vec, out result);
return result; return result;
} }
/// <summary>Transform a Vector by the given Matrix using right-handed notation</summary> /// <summary>Transform a Vector by the given Matrix using right-handed notation</summary>
/// <param name="vec">The vector to transform</param> /// <param name="mat">The desired transformation</param>
/// <param name="mat">The desired transformation</param> /// <param name="vec">The vector to transform</param>
/// <param name="result">The transformed vector</param> /// <param name="result">The transformed vector</param>
public static void RightHandedTransform(ref Vector3 vec, ref Matrix4 mat, out Vector3 result) public static void Transform(ref Matrix4 mat, ref Vector3 vec, out Vector3 result)
{ {
result = new Vector3( result = new Vector3(
mat.Row0.X * vec.X + mat.Row0.Y * vec.Y + mat.Row0.Z * vec.Z + mat.Row0.W, mat.Row0.X * vec.X + mat.Row0.Y * vec.Y + mat.Row0.Z * vec.Z + mat.Row0.W,
mat.Row1.X * vec.X + mat.Row1.Y * vec.Y + mat.Row1.Z * vec.Z + mat.Row1.W, mat.Row1.X * vec.X + mat.Row1.Y * vec.Y + mat.Row1.Z * vec.Z + mat.Row1.W,
mat.Row2.X * vec.X + mat.Row2.Y * vec.Y + mat.Row2.Z * vec.Z + mat.Row2.W); mat.Row2.X * vec.X + mat.Row2.Y * vec.Y + mat.Row2.Z * vec.Z + mat.Row2.W);
} }
/// <summary>Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3</summary> /// <summary>Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3</summary>
/// <param name="vec">The vector to transform</param> /// <param name="vec">The vector to transform</param>
@ -1570,55 +1571,55 @@ namespace OpenTK
return vec; return vec;
} }
/// <summary> /// <summary>
/// Transform a Vector by the given Matrix. /// Transform a Vector by the given Matrix.
/// </summary> /// </summary>
/// <param name="vec">The vector to transform</param> /// <param name="vec">The vector to transform</param>
/// <param name="mat">The desired transformation</param> /// <param name="mat">The desired transformation</param>
/// <returns>The transformed vector</returns> /// <returns>The transformed vector</returns>
public static Vector3 operator *(Vector3 vec, Matrix3 mat) public static Vector3 operator *(Vector3 vec, Matrix3 mat)
{ {
Vector3 result; Vector3 result;
Vector3.Transform(ref vec, ref mat, out result); Vector3.Transform(ref vec, ref mat, out result);
return result; return result;
} }
/// <summary> /// <summary>
/// Transform a Vector by the given Matrix. /// Transform a Vector by the given Matrix.
/// </summary> /// </summary>
/// <param name="vec">The vector to transform</param> /// <param name="vec">The vector to transform</param>
/// <param name="mat">The desired transformation</param> /// <param name="mat">The desired transformation</param>
/// <returns>The transformed vector</returns> /// <returns>The transformed vector</returns>
public static Vector3 operator *(Vector3 vec, Matrix4 mat) public static Vector3 operator *(Vector3 vec, Matrix4 mat)
{
Vector3 result;
Vector3.Transform(ref vec, ref mat, out result);
return result;
}
/// <summary>
/// Transform a Vector by the given Matrix using right-handed notation
/// </summary>
/// <param name="vec">The vector to transform</param>
/// <param name="mat">The desired transformation</param>
/// <returns>The transformed vector</returns>
public static Vector3 operator *(Matrix3 mat, Vector3 vec)
{ {
Vector3 result; Vector3 result;
Vector3.RightHandedTransform(ref vec, ref mat, out result); Vector3.Transform(ref vec, ref mat, out result);
return result; return result;
} }
/// <summary> /// <summary>
/// Transform a Vector by the given Matrix using right-handed notation /// Transform a Vector by the given Matrix using right-handed notation
/// </summary> /// </summary>
/// <param name="vec">The vector to transform</param> /// <param name="mat">The desired transformation</param>
/// <param name="mat">The desired transformation</param> /// <param name="vec">The vector to transform</param>
/// <returns>The transformed vector</returns> /// <returns>The transformed vector</returns>
public static Vector3 operator *(Matrix4 mat, Vector3 vec) public static Vector3 operator *(Matrix3 mat, Vector3 vec)
{ {
Vector3 result; Vector3 result;
Vector3.RightHandedTransform(ref vec, ref mat, out result); Vector3.Transform(ref mat, ref vec, out result);
return result;
}
/// <summary>
/// Transform a Vector by the given Matrix using right-handed notation
/// </summary>
/// <param name="mat">The desired transformation</param>
/// <param name="vec">The vector to transform</param>
/// <returns>The transformed vector</returns>
public static Vector3 operator *(Matrix4 mat, Vector3 vec)
{
Vector3 result;
Vector3.Transform(ref mat, ref vec, out result);
return result; return result;
} }

View file

@ -25,6 +25,7 @@ SOFTWARE.
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace OpenTK namespace OpenTK
{ {
/// <summary>Represents a 4D vector using four single-precision floating-point numbers.</summary> /// <summary>Represents a 4D vector using four single-precision floating-point numbers.</summary>
@ -1017,28 +1018,28 @@ namespace OpenTK
result = new Vector4(v.X, v.Y, v.Z, v.W); result = new Vector4(v.X, v.Y, v.Z, v.W);
} }
/// <summary>Transform a Vector by the given Matrix using right-handed notation</summary> /// <summary>Transform a Vector by the given Matrix using right-handed notation</summary>
/// <param name="vec">The vector to transform</param> /// <param name="mat">The desired transformation</param>
/// <param name="mat">The desired transformation</param> /// <param name="vec">The vector to transform</param>
public static Vector4 RightHandedTransform(Vector4 vec, Matrix4 mat) public static Vector4 Transform(Matrix4 mat, Vector4 vec)
{ {
Vector4 result; Vector4 result;
RightHandedTransform(ref vec, ref mat, out result); Transform(ref mat, ref vec, out result);
return result; return result;
} }
/// <summary>Transform a Vector by the given Matrix using right-handed notation</summary> /// <summary>Transform a Vector by the given Matrix using right-handed notation</summary>
/// <param name="vec">The vector to transform</param> /// <param name="mat">The desired transformation</param>
/// <param name="mat">The desired transformation</param> /// <param name="vec">The vector to transform</param>
/// <param name="result">The transformed vector</param> /// <param name="result">The transformed vector</param>
public static void RightHandedTransform(ref Vector4 vec, ref Matrix4 mat, out Vector4 result) public static void Transform(ref Matrix4 mat, ref Vector4 vec, out Vector4 result)
{ {
result = new OpenTK.Vector4( result = new Vector4(
mat.Row0.X * vec.X + mat.Row0.Y * vec.Y + mat.Row0.Z * vec.Z + mat.Row0.W * vec.W, mat.Row0.X * vec.X + mat.Row0.Y * vec.Y + mat.Row0.Z * vec.Z + mat.Row0.W * vec.W,
mat.Row1.X * vec.X + mat.Row1.Y * vec.Y + mat.Row1.Z * vec.Z + mat.Row1.W * vec.W, mat.Row1.X * vec.X + mat.Row1.Y * vec.Y + mat.Row1.Z * vec.Z + mat.Row1.W * vec.W,
mat.Row2.X * vec.X + mat.Row2.Y * vec.Y + mat.Row2.Z * vec.Z + mat.Row2.W * vec.W, mat.Row2.X * vec.X + mat.Row2.Y * vec.Y + mat.Row2.Z * vec.Z + mat.Row2.W * vec.W,
mat.Row3.X * vec.X + mat.Row3.Y * vec.Y + mat.Row3.Z * vec.Z + mat.Row3.W * vec.W); mat.Row3.X * vec.X + mat.Row3.Y * vec.Y + mat.Row3.Z * vec.Z + mat.Row3.W * vec.W);
} }
#endregion #endregion
@ -1513,7 +1514,7 @@ namespace OpenTK
vec.W *= scale; vec.W *= scale;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Component-wise multiplication between the specified instance by a scale vector. /// Component-wise multiplication between the specified instance by a scale vector.
/// </summary> /// </summary>
@ -1529,39 +1530,39 @@ namespace OpenTK
return vec; return vec;
} }
/// <summary> /// <summary>
/// Transform a Vector by the given Matrix. /// Transform a Vector by the given Matrix.
/// </summary> /// </summary>
/// <param name="vec">The vector to transform</param> /// <param name="vec">The vector to transform</param>
/// <param name="mat">The desired transformation</param> /// <param name="mat">The desired transformation</param>
/// <returns>The transformed vector</returns> /// <returns>The transformed vector</returns>
public static Vector4 operator *(Vector4 vec, Matrix4 mat) public static Vector4 operator *(Vector4 vec, Matrix4 mat)
{ {
Vector4 result; Vector4 result;
Vector4.Transform(ref vec, ref mat, out result); Vector4.Transform(ref vec, ref mat, out result);
return result; return result;
} }
/// <summary> /// <summary>
/// Transform a Vector by the given Matrix using right-handed notation /// Transform a Vector by the given Matrix using right-handed notation
/// </summary> /// </summary>
/// <param name="vec">The vector to transform</param> /// <param name="mat">The desired transformation</param>
/// <param name="mat">The desired transformation</param> /// <param name="vec">The vector to transform</param>
/// <returns>The transformed vector</returns> /// <returns>The transformed vector</returns>
public static Vector4 operator *(Matrix4 mat, Vector4 vec) public static Vector4 operator *(Matrix4 mat, Vector4 vec)
{ {
Vector4 result; Vector4 result;
Vector4.RightHandedTransform(ref vec, ref mat, out result); Vector4.Transform(ref mat, ref vec, out result);
return result; return result;
} }
/// <summary> /// <summary>
/// Transforms a vector by a quaternion rotation. /// Transforms a vector by a quaternion rotation.
/// </summary> /// </summary>
/// <param name="vec">The vector to transform.</param> /// <param name="quat">The quaternion to rotate the vector by.</param>
/// <param name="quat">The quaternion to rotate the vector by.</param> /// <param name="vec">The vector to transform.</param>
/// <returns>The transformed vector</returns> /// <returns>The transformed vector</returns>
public static Vector4 operator *(Quaternion quat, Vector4 vec) public static Vector4 operator *(Quaternion quat, Vector4 vec)
{ {
Vector4 result; Vector4 result;
Vector4.Transform(ref vec, ref quat, out result); Vector4.Transform(ref vec, ref quat, out result);