signOfDet2x2 static method

int signOfDet2x2(
  1. double dx1,
  2. double dy1,
  3. double dx2,
  4. double dy2,
)

Computes the sign of the determinant of the 2x2 matrix with the given entries.

@return -1 if the determinant is negative, @return 1 if the determinant is positive, @return 0 if the determinant is 0.

Implementation

static int signOfDet2x2(double dx1, double dy1, double dx2, double dy2) {
  DD x1 = DD.valueOf(dx1);
  DD y1 = DD.valueOf(dy1);
  DD x2 = DD.valueOf(dx2);
  DD y2 = DD.valueOf(dy2);

  DD det = x1.multiplyDD(y2).selfSubtractDD(y1.multiplyDD(x2));
  return det.signum();
}