Here you can find the source of cross(double v1[], double v2[])
Parameter | Description |
---|---|
v1 | a parameter |
v2 | a parameter |
public static double[] cross(double v1[], double v2[])
//package com.java2s; //License from project: Academic Free License public class Main { /**//from w ww . j a va 2 s.c o m * Calculates cross product of two vectors. * * @param v1 * @param v2 * @return */ public static double[] cross(double v1[], double v2[]) { double v[] = new double[3]; v[0] = v1[1] * v2[2] - v1[2] * v2[1]; v[1] = v1[2] * v2[0] - v1[0] * v2[2]; v[2] = v1[0] * v2[1] - v1[1] * v2[0]; return v; } }