MTExample5_5.Matrix3.VectorMultiply C# (CSharp) Method

VectorMultiply() public method

public VectorMultiply ( float vector ) : float[]
vector float
return float[]
        public float[] VectorMultiply(float[] vector)
        {
            float[] result = new float[4];
            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    result[i] += M[i, j] * vector[j];
                }
            }
            return result;
        }

Usage Example

 public void TransformNormalize(Matrix3 m)
 {
     float[] result = m.VectorMultiply (new float[4] { X, Y, Z, W });
     X = result [0] / result [3];
     Y = result [1] / result [3];
     Z = result [2];
     W = 1;
 }
All Usage Examples Of MTExample5_5.Matrix3::VectorMultiply