Multiply() public static method

Multiplies the two matrices.
public static Multiply ( Matrix &a, Matrix3x3 &b, Matrix3x3 &result ) : void
a Matrix First matrix to multiply.
b Matrix3x3 Second matrix to multiply.
result Matrix3x3 Product of the multiplication.
return void
示例#1
0
        /// <summary>
        /// Multiplies the two matrices.
        /// </summary>
        /// <param name="a">First matrix to multiply.</param>
        /// <param name="b">Second matrix to multiply.</param>
        /// <returns>Product of the multiplication.</returns>
        public static Matrix3x3 operator *(Matrix3x3 a, Matrix3x3 b)
        {
            Matrix3x3 result;

            Matrix3x3.Multiply(ref a, ref b, out result);
            return(result);
        }
        ///<summary>
        /// Constructs a new affine transform.
        ///</summary>
        ///<param name="scaling">Scaling to apply in the linear transform.</param>
        ///<param name="orientation">Orientation to apply in the linear transform.</param>
        ///<param name="translation">Translation to apply.</param>
        public AffineTransform(Vector3 scaling, Quaternion orientation, Vector3 translation)
        {
            //Create an SRT transform.
            Matrix3x3.CreateScale(ref scaling, out LinearTransform);
            Matrix3x3 rotation;

            Matrix3x3.CreateFromQuaternion(ref orientation, out rotation);
            Matrix3x3.Multiply(ref LinearTransform, ref rotation, out LinearTransform);
            Translation = translation;
        }
        /// <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;
        }
        ///<summary>
        /// Multiplies a rigid transform by an affine transform.
        ///</summary>
        ///<param name="a">Rigid transform.</param>
        ///<param name="b">Affine transform.</param>
        ///<param name="transform">Combined transform.</param>
        public static void Multiply(ref RigidTransform a, ref AffineTransform b, out AffineTransform transform)
        {
            Matrix3x3 linearTransform;//Have to use temporary variable just in case b reference is transform.

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

            Matrix3x3.Transform(ref a.Position, ref b.LinearTransform, out translation);
            Vector3.Add(ref translation, ref b.Translation, out transform.Translation);
            transform.LinearTransform = linearTransform;
        }