/** * return the maximum element difference between the two 3*3 matrices. * @param A A * @param B B * @return difference */ public static double dMaxDifference (final DMatrix3C A, final DMatrix3C B) { double diff,max; max = 0; for (int i=0; i<3; i++) { for (int j=0; j<3; j++) { diff = Math.abs(A.get(i,j) - B.get(i,j)); if (diff > max) { max = diff; } } } return max; } /**
/** * return the maximum element difference between the two 3*3 matrices. * @param A A * @param B B * @return difference */ public static double dMaxDifference (final DMatrix3C A, final DMatrix3C B) { double diff,max; max = 0; for (int i=0; i<3; i++) { for (int j=0; j<3; j++) { diff = Math.abs(A.get(i,j) - B.get(i,j)); if (diff > max) { max = diff; } } } return max; } /**
/** * Compares two matrices for equality. * This is marginally faster than <tt>equals(Object o)</tt>. */ @Override public final boolean isEq(DMatrix3C m) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (get(i, j) != m.get(i, j)) return false; } } return true; }
/** * Compares two matrices for equality. * This is marginally faster than <tt>equals(Object o)</tt>. */ @Override public final boolean isEq(DMatrix3C m) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (get(i, j) != m.get(i, j)) return false; } } return true; }
void compareMassParams (DMass m1, DMass m2, final String msg) { int i,j; boolean ok = true; if (!(cmp(m1.getMass(),m2.getMass()) && cmp(m1.getC().get0(),m2.getC().get0()) && cmp(m1.getC().get1(),m2.getC().get1()) && cmp(m1.getC().get2(),m2.getC().get2()))) ok = false; for (i=0; i<3; i++) for (j=0; j<3; j++) if (cmp (m1.getI().get(i,j),m2.getI().get(i,j))==false) ok = false; if (ok) printf ("\tpassed (%s)\n",msg); else printf ("\tFAILED (%s)\n",msg); }
private void compareMassParams (DMass m1, DMass m2, final String msg) { int i,j; boolean ok = true; if (!(cmp(m1.getMass(),m2.getMass()) && cmp(m1.getC().get0(),m2.getC().get0()) && cmp(m1.getC().get1(),m2.getC().get1()) && cmp(m1.getC().get2(),m2.getC().get2()))) ok = false; for (i=0; i<3; i++) for (j=0; j<3; j++) if (cmp (m1.getI().get(i,j),m2.getI().get(i,j))==false) ok = false; if (ok) println ("\tpassed (", msg, ")"); else println ("\tFAILED (", msg, ")"); }
sign = (dCalcVectorDot3_14(normal,R1,j) > 0) ? (1.0) : (-1.0); for (i=0; i<3; i++) pa.add(i, sign * A.get(j) * R1.get(i, j) ); sign = (dCalcVectorDot3_14(normal,R2,j) > 0) ? (-1.0) : (1.0); for (i=0; i<3; i++) pb.add(i, sign * B.get(j) * R2.get(i, j) ); for (i=0; i<3; i++) ua.set(i, R1.get(i, (tst._code-7)/3 ) ); for (i=0; i<3; i++) ub.set(i, R2.get(i, (tst._code-7)%3 ) ); if (nr.get(lanr) < 0) { for (i=0; i<3; i++) center.set(i, pb.get(i) - pa.get(i) + Sb.get(lanr) * Rb.get(i, lanr) ); for (i=0; i<3; i++) center.set(i, pb.get(i) - pa.get(i) - Sb.get(lanr) * Rb.get(i, lanr) ); for (i=0; i<3; i++) point[cnum*3+i] = center.get(i) + k1*Rb.get(i, a1) + k2*Rb.get(i, a2); dep[cnum] = Sa.get(codeN) - dCalcVectorDot3(normal2, point,cnum*3); if (dep[cnum] >= 0) {
sign = (dCalcVectorDot3_14(normal,R1,j) > 0) ? (1.0) : (-1.0); for (i=0; i<3; i++) pa.add(i, sign * A.get(j) * R1.get(i, j) ); sign = (dCalcVectorDot3_14(normal,R2,j) > 0) ? (-1.0) : (1.0); for (i=0; i<3; i++) pb.add(i, sign * B.get(j) * R2.get(i, j) ); for (i=0; i<3; i++) ua.set(i, R1.get(i, (tst._code-7)/3 ) ); for (i=0; i<3; i++) ub.set(i, R2.get(i, (tst._code-7)%3 ) ); if (nr.get(lanr) < 0) { for (i=0; i<3; i++) center.set(i, pb.get(i) - pa.get(i) + Sb.get(lanr) * Rb.get(i, lanr) ); for (i=0; i<3; i++) center.set(i, pb.get(i) - pa.get(i) - Sb.get(lanr) * Rb.get(i, lanr) ); for (i=0; i<3; i++) point[cnum*3+i] = center.get(i) + k1*Rb.get(i, a1) + k2*Rb.get(i, a2); dep[cnum] = Sa.get(codeN) - dCalcVectorDot3(normal2, point,cnum*3); if (dep[cnum] >= 0) {