Here you can find the source of cross(float[] vec1, float[] vec2)
Parameter | Description |
---|---|
vec1 | vector 1 |
vec2 | vecttor 2 |
public static float[] cross(float[] vec1, float[] vec2)
//package com.java2s; public class Main { /** cross product vec1 x vec2 * @param vec1 vector 1/*from w w w . j a v a 2 s.c o m*/ * @param vec2 vecttor 2 * @return the resulting vector */ public static float[] cross(float[] vec1, float[] vec2) { float[] out = new float[3]; out[0] = vec2[2] * vec1[1] - vec2[1] * vec1[2]; out[1] = vec2[0] * vec1[2] - vec2[2] * vec1[0]; out[2] = vec2[1] * vec1[0] - vec2[0] * vec1[1]; return out; } }