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; }
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; }