Axiom.Math.Matrix4.TransformAffine C# (CSharp) Method

TransformAffine() public method

4-D Vector transformation specially for affine matrix.
The matrix must be an affine matrix. Matrix4.IsAffine.
public TransformAffine ( Vector4 v ) : Vector4
v Vector4
return Vector4
		public Vector4 TransformAffine( Vector4 v )
		{
			Debug.Assert( IsAffine );

			return new Vector4(
				m00 * v.x + m01 * v.y + m02 * v.z + m03 * v.w,
				m10 * v.x + m11 * v.y + m12 * v.z + m13 * v.w,
				m20 * v.x + m21 * v.y + m22 * v.z + m23 * v.w,
				v.w );
		}

Same methods

Matrix4::TransformAffine ( Vector3 v ) : Vector3

Usage Example

Example #1
0
        public void TransformAffine(Matrix4 m)
        {
            Debug.Assert(m.IsAffine);

            // Do nothing if current null or infinite
            if (this.isNull || this.isInfinite)
            {
                return;
            }

            Vector3 centre   = Center;
            Vector3 halfSize = HalfSize;

            Vector3 newCentre   = m.TransformAffine(centre);
            var     newHalfSize =
                new Vector3(
                    Utility.Abs(m[0, 0]) * halfSize.x + Utility.Abs(m[0, 1]) * halfSize.y + Utility.Abs(m[0, 2]) * halfSize.z,
                    Utility.Abs(m[1, 0]) * halfSize.x + Utility.Abs(m[1, 1]) * halfSize.y + Utility.Abs(m[1, 2]) * halfSize.z,
                    Utility.Abs(m[2, 0]) * halfSize.x + Utility.Abs(m[2, 1]) * halfSize.y + Utility.Abs(m[2, 2]) * halfSize.z);

            SetExtents(newCentre - newHalfSize, newCentre + newHalfSize);
        }
All Usage Examples Of Axiom.Math.Matrix4::TransformAffine