public static TransformTranspose ( System.Vector3 v, |
||
v | System.Vector3 | Vector3 to transform. |
matrix | Matrix to use as the transformation transpose. | |
return | System.Vector3 |
public static Vector3 TransformTranspose(Vector3 v, Matrix3x3 matrix)
{
float vX = v.X;
float vY = v.Y;
float vZ = v.Z;
Vector3 result;
#if !WINDOWS
result = new Vector3();
#endif
result.X = vX * matrix.M11 + vY * matrix.M12 + vZ * matrix.M13;
result.Y = vX * matrix.M21 + vY * matrix.M22 + vZ * matrix.M23;
result.Z = vX * matrix.M31 + vY * matrix.M32 + vZ * matrix.M33;
return result;
}
Matrix3x3::TransformTranspose ( System.Vector3 &v, Matrix &matrix, System.Vector3 &result ) : void | |
Matrix3x3::TransformTranspose ( System.Vector3 &v, |
///<summary> /// Transforms a vector by an affine transform's inverse. ///</summary> ///<param name="position">Position to transform.</param> ///<param name="transform">Transform to invert and apply.</param> ///<param name="transformed">Transformed position.</param> public static void TransformInverse(ref Vector3 position, ref AffineTransform transform, out Vector3 transformed) { Vector3.Subtract(ref position, ref transform.Translation, out transformed); Matrix3x3 inverse; Matrix3x3.Invert(ref transform.LinearTransform, out inverse); Matrix3x3.TransformTranspose(ref transformed, ref inverse, out transformed); }