/** * Generate the middle Point between two poits A and B * * @param A the first Point * @param B the second Point * @return the middle Point * @throws ArrayIndexOutOfBoundsException */ public static SFVertex4f middle(SFVertex4f A, SFVertex4f B) { return new SFVertex4f( (A.getV()[0] + B.getV()[0]) * 0.5f, (A.getV()[1] + B.getV()[1]) * 0.5f, (A.getV()[2] + B.getV()[2]) * 0.5f, (A.getV()[3] + B.getV()[3]) * 0.5f); }
/** * Specific 4f version of the dot method. * * @param vx * @return */ public double dot4f(SFVertex4f vx) { return vx.getV()[0] * getV()[0] + vx.getV()[1] * getV()[1] + vx.getV()[2] * getV()[2] + vx.getV()[3] * getV()[3]; }
/** * Specific 4f version of the addMult method. * * @param a * @param vx */ public void addMult4f(float a, SFVertex4f vx) { getV()[0] += vx.getV()[0] * a; getV()[1] += vx.getV()[1] * a; getV()[2] += vx.getV()[2] * a; getV()[3] += vx.getV()[3] * a; }
/** * Specific 4f version of the add method. * * @param vx the constant to be added */ public void add4f(SFVertex4f q) { getV()[0] += q.getV()[0]; getV()[1] += q.getV()[1]; getV()[2] += q.getV()[2]; getV()[3] += q.getV()[3]; }
/** * Specific 4f version of the subtract method. * * @param vx */ public void subtract4f(SFVertex4f q) { getV()[0] -= q.getV()[0]; getV()[1] -= q.getV()[1]; getV()[2] -= q.getV()[2]; getV()[3] -= q.getV()[3]; }