BEPUutilities.Matrix3x3.Transform C# (CSharp) 메소드

Transform() 공개 정적인 메소드

Transforms the vector by the matrix.
public static Transform ( System.Vector3 v, Matrix3x3 matrix ) : System.Vector3
v System.Vector3 Vector3 to transform.
matrix Matrix3x3 Matrix to use as the transformation.
리턴 System.Vector3
        public static Vector3 Transform(Vector3 v, Matrix3x3 matrix)
        {
            Vector3 result;
#if !WINDOWS
            result = new Vector3();
#endif
            float vX = v.X;
            float vY = v.Y;
            float vZ = v.Z;

            result.X = vX * matrix.M11 + vY * matrix.M21 + vZ * matrix.M31;
            result.Y = vX * matrix.M12 + vY * matrix.M22 + vZ * matrix.M32;
            result.Z = vX * matrix.M13 + vY * matrix.M23 + vZ * matrix.M33;
            return result;
        }

Same methods

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

Usage Example

예제 #1
0
        /// <summary>
        /// Multiplies a transform by another transform.
        /// </summary>
        /// <param name="a">First transform.</param>
        /// <param name="b">Second transform.</param>
        /// <param name="transform">Combined transform.</param>
        public static void Multiply(ref AffineTransform a, ref AffineTransform b, out AffineTransform transform)
        {
            Matrix3x3 linearTransform;//Have to use temporary variable just in case a or b reference is transform.

            Matrix3x3.Multiply(ref a.LinearTransform, ref b.LinearTransform, out linearTransform);
            Vector3 translation;

            Matrix3x3.Transform(ref a.Translation, ref b.LinearTransform, out translation);
            Vector3.Add(ref translation, ref b.Translation, out transform.Translation);
            transform.LinearTransform = linearTransform;
        }
All Usage Examples Of BEPUutilities.Matrix3x3::Transform