isAcute static method
Tests whether the angle between p0-p1-p2 is acute. An angle is acute if it is less than 90 degrees.
Note: this implementation is not precise (deterministic) for angles very close to 90 degrees.
@param p0 an endpoint of the angle @param p1 the base of the angle @param p2 the other endpoint of the angle @return true if the angle is acute
Implementation
static bool isAcute(Coordinate p0, Coordinate p1, Coordinate p2) {
// relies on fact that A dot B is positive iff A ang B is acute
double dx0 = p0.x - p1.x;
double dy0 = p0.y - p1.y;
double dx1 = p2.x - p1.x;
double dy1 = p2.y - p1.y;
double dotprod = dx0 * dx1 + dy0 * dy1;
return dotprod > 0;
}