getTurn static method
Returns whether an angle must turn clockwise or counterclockwise to overlap another angle.
@param ang1 an angle (in radians) @param ang2 an angle (in radians) @return whether a1 must turn CLOCKWISE, COUNTERCLOCKWISE or NONE to overlap a2.
Implementation
static int getTurn(double ang1, double ang2) {
double crossproduct = math.sin(ang2 - ang1);
if (crossproduct > 0) {
return COUNTERCLOCKWISE;
}
if (crossproduct < 0) {
return CLOCKWISE;
}
return NONE;
}