зеркало из https://github.com/stride3d/opentk.git
Added Matrix3[d].Add and Matrix4[d].CreateFromRotationMatrix
This commit is contained in:
Родитель
6bb7c1d406
Коммит
ee56a3506d
|
@ -667,7 +667,25 @@ namespace OpenTK
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Add Functions
|
||||
|
||||
public static Matrix3 Add(Matrix3 left, Matrix3 right)
|
||||
{
|
||||
Matrix3 result;
|
||||
Add(ref left, ref right, out result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void Add(ref Matrix3 left, ref Matrix3 right, out Matrix3 result)
|
||||
{
|
||||
Vector3.Add(ref left.Row0, ref right.Row0, out result.Row0);
|
||||
Vector3.Add(ref left.Row1, ref right.Row1, out result.Row1);
|
||||
Vector3.Add(ref left.Row2, ref right.Row2, out result.Row2);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Multiply Functions
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -664,7 +664,25 @@ namespace OpenTK
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Add Functions
|
||||
|
||||
public static Matrix3d Add(Matrix3d left, Matrix3d right)
|
||||
{
|
||||
Matrix3d result;
|
||||
Add(ref left, ref right, out result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void Add(ref Matrix3d left, ref Matrix3d right, out Matrix3d result)
|
||||
{
|
||||
Vector3d.Add(ref left.Row0, ref right.Row0, out result.Row0);
|
||||
Vector3d.Add(ref left.Row1, ref right.Row1, out result.Row1);
|
||||
Vector3d.Add(ref left.Row2, ref right.Row2, out result.Row2);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Multiply Functions
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -592,6 +592,37 @@ namespace OpenTK
|
|||
|
||||
#endregion
|
||||
|
||||
#region CreateFromRotationMatrix
|
||||
|
||||
public static Matrix4 CreateFromRotationMatrix(Matrix3 rotation)
|
||||
{
|
||||
Matrix4 result;
|
||||
CreateFromRotationMatrix(ref rotation, out result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void CreateFromRotationMatrix(ref Matrix3 rotation, out Matrix4 result)
|
||||
{
|
||||
result.Row0.X = rotation.Row0.X;
|
||||
result.Row0.Y = rotation.Row0.Y;
|
||||
result.Row0.Z = rotation.Row0.Z;
|
||||
result.Row0.W = 0;
|
||||
result.Row1.X = rotation.Row1.X;
|
||||
result.Row1.Y = rotation.Row1.Y;
|
||||
result.Row1.Z = rotation.Row1.Z;
|
||||
result.Row1.W = 0;
|
||||
result.Row2.X = rotation.Row2.X;
|
||||
result.Row2.Y = rotation.Row2.Y;
|
||||
result.Row2.Z = rotation.Row2.Z;
|
||||
result.Row2.W = 0;
|
||||
result.Row3.X = 0;
|
||||
result.Row3.Y = 0;
|
||||
result.Row3.Z = 0;
|
||||
result.Row3.W = 1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateRotation[XYZ]
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -551,6 +551,37 @@ namespace OpenTK
|
|||
|
||||
#endregion
|
||||
|
||||
#region CreateFromRotationMatrix
|
||||
|
||||
public static Matrix4d CreateFromRotationMatrix(Matrix3d rotation)
|
||||
{
|
||||
Matrix4d result;
|
||||
CreateFromRotationMatrix(ref rotation, out result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void CreateFromRotationMatrix(ref Matrix3d rotation, out Matrix4d result)
|
||||
{
|
||||
result.Row0.X = rotation.Row0.X;
|
||||
result.Row0.Y = rotation.Row0.Y;
|
||||
result.Row0.Z = rotation.Row0.Z;
|
||||
result.Row0.W = 0;
|
||||
result.Row1.X = rotation.Row1.X;
|
||||
result.Row1.Y = rotation.Row1.Y;
|
||||
result.Row1.Z = rotation.Row1.Z;
|
||||
result.Row1.W = 0;
|
||||
result.Row2.X = rotation.Row2.X;
|
||||
result.Row2.Y = rotation.Row2.Y;
|
||||
result.Row2.Z = rotation.Row2.Z;
|
||||
result.Row2.W = 0;
|
||||
result.Row3.X = 0;
|
||||
result.Row3.Y = 0;
|
||||
result.Row3.Z = 0;
|
||||
result.Row3.W = 1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateRotation[XYZ]
|
||||
|
||||
/// <summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче