Java Array Multiply multiplyVectorByMatrix(double[] v, double[] m, double[] result)

Here you can find the source of multiplyVectorByMatrix(double[] v, double[] m, double[] result)

Description

Based on: http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c

License

BSD License

Declaration

public static void multiplyVectorByMatrix(double[] v, double[] m, double[] result) 

Method Source Code

//package com.java2s;
//License from project: BSD License 

public class Main {
    /**//from w ww. jav  a 2 s .  c om
     * Based on: http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c
     */
    public static void multiplyVectorByMatrix(double[] v, double[] m, double[] result) {
        double vx = v[0], vy = v[1], vz = v[2], vw = v[3];
        result[0] = vx * m[0] + vy * m[4] + vz * m[8] + vw * m[12];
        result[1] = vx * m[1] + vy * m[5] + vz * m[9] + vw * m[13];
        result[2] = vx * m[2] + vy * m[6] + vz * m[10] + vw * m[14];
        result[3] = vx * m[3] + vy * m[7] + vz * m[11] + vw * m[15];
    }
}

Related

  1. multiplySparse(int[][][] as, int A, int[][][] bs, int B, int[][][] cs)
  2. multiplySquares(float[] mat1, float[] mat2, int sidelength)
  3. multiplyValues(byte[] array, int multiplier)
  4. multiplyVecorWithScalar(double[] v, double s)
  5. multiplyVector(float[] mat, float[] vec, float[] dest)
  6. multiplyX(long[] x, long[] z)
  7. multiplyX(long[] x, long[] z)