Java Array Cross Product cross(final double[] a, final double[] b, final double[] c)

Here you can find the source of cross(final double[] a, final double[] b, final double[] c)

Description

compute cross product, set c = a ^ b.

License

Open Source License

Parameter

Parameter Description
a a parameter
b a parameter

Declaration

public static void cross(final double[] a, final double[] b,
        final double[] c) 

Method Source Code

//package com.java2s;

public class Main {
    /**/* w  w w.  j a  v  a 2s .co  m*/
     * compute cross product, set c = a ^ b.
     * 
     * Dimensions of a, b, and c must equal 3.
     * 
     * @param a
     * @param b
     */
    public static void cross(final double[] a, final double[] b,
            final double[] c) {
        c[0] = a[1] * b[2] - a[2] * b[1];
        c[1] = a[2] * b[0] - a[0] * b[2];
        c[2] = a[0] * b[1] - a[1] * b[0];
    }
}

Related

  1. cross(double v0x, double v0y, double v1x, double v1y)
  2. cross(double v1[], double v2[])
  3. cross(double[] p, double[] q)
  4. cross(double[] vec1, double[] vec2, double[] outvec)
  5. cross(final double[] left, final double[] right)
  6. cross(float[] v1, float[] v2, float[] out)
  7. cross(float[] vec1, float[] vec2)
  8. cross(int x1, int y1, int x2, int y2)