List of utility methods to do Array Cross Product
int | cross2D(int[] v, int[] u) 2D cross product. return v[0] * u[1] - v[1] * u[0];
|
double[] | cross3(double x1, double y1, double z1, double x2, double y2, double z2) cross double[] v = new double[3]; v[0] = y1 * z2 - z1 * y2; v[1] = z1 * x2 - x1 * z2; v[2] = x1 * y2 - y1 * x2; return v; |
float[] | cross33(float u[], float v[]) cross float m[] = new float[3]; m[0] = u[1] * v[2] - u[2] * v[1]; m[1] = u[2] * v[0] - u[0] * v[2]; m[2] = u[0] * v[1] - u[1] * v[0]; return m; |
double[][] | crossEndForLineVectorAlgebra(double x1, double y1, double x2, double y2, double margin, double width) Calculate cross end for given line with vector algebra: ---------------x-- Cross points: C D A---------------x--B E F Usage code: double[][] result = new double[2][4]; double[] baseVector = { x2 - x1, y2 - y1 }; double baseVectorLenght = Math.sqrt(baseVector[0] * baseVector[0] + baseVector[1] * baseVector[1]); double[] baseUnitVector = { baseVector[0] / baseVectorLenght, baseVector[1] / baseVectorLenght }; double[] normal = { -baseUnitVector[1], baseUnitVector[0] }; result[0][0] = x2 - baseUnitVector[0] * (margin + width / 2) - normal[0] * width / 2; result[1][0] = y2 - baseUnitVector[1] * (margin + width / 2) - normal[1] * width / 2; result[0][1] = x2 - baseUnitVector[0] * (margin - width / 2) - normal[0] * width / 2; ... |
double | crossMuliply(double a, double b, double c) Does a cross multiplication, where it returns d, where in (d = bc / a) return b * c / a;
|
int | crossMult(int value, int maximum, int coefficient) Do a cross multiplication return (int) ((double) value / (double) maximum * (double) coefficient); |
double | crossProduct(double x1, double y1, double x2, double y2, double x3, double y3) Compute cross product : o(x2,y2) / cp > 0 / / cp < 0 / / o (x1, y1) return (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
|
double[] | crossProduct(double[] output, double[] a, double[] b) cross Product output[0] = a[1] * b[2] - a[2] * b[1];
output[1] = a[2] * b[0] - a[0] * b[2];
output[2] = a[0] * b[1] - a[1] * b[0];
return output;
|
double[] | CrossProduct(final double[] vect1, final double[] vect2) Cross Product final double[] result = new double[3]; result[0] = vect1[1] * vect2[2] - vect1[2] * vect2[1]; result[1] = vect1[2] * vect2[0] - vect1[0] * vect2[2]; result[2] = vect1[0] * vect2[1] - vect1[1] * vect2[0]; return result; |
int | crossProduct(int ax, int ay, int bx, int by, int cx, int cy) cross Product return (ax - cx) * (by - cy) - (ay - cy) * (bx - cx);
|