@Test public void scalarMultiply() throws Exception { float vec1[] = {1, 0, 0}; float vec2[] = {0, 1, 0}; float res = Vector3D.scalarMultiply(vec1, vec2); assertTrue(equal(res, 0)); float v3[] = {5, 0, 0}; float v4[] = {3, -1, 0}; res = Vector3D.scalarMultiply(v3, v4); assertTrue(equal(res, 15)); }
public static float scalarMultiply(float[] lhs, float[] rhs) { return lhs[x]*rhs[x] + lhs[y]*rhs[y] + lhs[z]*rhs[z]; }
Vector3D { public static float scalarMultiply(float[] lhs, float[] rhs) { return lhs[x]*rhs[x] + lhs[y]*rhs[y] + lhs[z]*rhs[z]; } }
Vector3D { public static float scalarMultiply(float[] lhs, float[] rhs) { return lhs[x]*rhs[x] + lhs[y]*rhs[y] + lhs[z]*rhs[z]; }  }
Vector3D { public static float scalarMultiply(float[] lhs, float[] rhs) { return lhs[x]*rhs[x] + lhs[y]*rhs[y] + lhs[z]*rhs[z]; }  static float[] vectorMultiply(float[] lhs, float[] rhs); static float scalarMultiply(float[] lhs, float[] rhs); static float distanceVertices(float[] left, float[] right); static float vectorLength(float[] vector); static float[] createVector(float[] start, float[] end); static float distanceDotLine(float[] dot, float[] lineA, float[] lineB); static float distancevertexSegment(float[] dot, float[] segmentStart, float[] segmentEnd); }
Vector3D { public static float scalarMultiply(float[] lhs, float[] rhs) { return lhs[x]*rhs[x] + lhs[y]*rhs[y] + lhs[z]*rhs[z]; }  static float[] vectorMultiply(float[] lhs, float[] rhs); static float scalarMultiply(float[] lhs, float[] rhs); static float distanceVertices(float[] left, float[] right); static float vectorLength(float[] vector); static float[] createVector(float[] start, float[] end); static float distanceDotLine(float[] dot, float[] lineA, float[] lineB); static float distancevertexSegment(float[] dot, float[] segmentStart, float[] segmentEnd); static final float Epsilon; }