BEPUutilities.Matrix3x3.TransformTranspose C# (CSharp) Метод

TransformTranspose() публичный статический Метод

Transforms the vector by the matrix's transpose.
public static TransformTranspose ( System.Vector3 v, Matrix3x3 matrix ) : System.Vector3
v System.Vector3 Vector3 to transform.
matrix Matrix3x3 Matrix to use as the transformation transpose.
Результат 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;
        }

Same methods

Matrix3x3::TransformTranspose ( System.Vector3 &v, Matrix &matrix, System.Vector3 &result ) : void
Matrix3x3::TransformTranspose ( System.Vector3 &v, Matrix3x3 &matrix, System.Vector3 &result ) : void

Usage Example

Пример #1
0
        ///<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);
        }