/** * Tests if a point is inside the circle defined by * the triangle with vertices a, b, c (oriented counter-clockwise). * This test uses simple * double-precision arithmetic, and thus may not be robust. * * @param a a vertex of the triangle * @param b a vertex of the triangle * @param c a vertex of the triangle * @param p the point to test * @return true if this point is inside the circle defined by the points a, b, c */ public static boolean isInCircleNonRobust( Coordinate a, Coordinate b, Coordinate c, Coordinate p) { boolean isInCircle = (a.x * a.x + a.y * a.y) * triArea(b, c, p) - (b.x * b.x + b.y * b.y) * triArea(a, c, p) + (c.x * c.x + c.y * c.y) * triArea(a, b, p) - (p.x * p.x + p.y * p.y) * triArea(a, b, c) > 0; return isInCircle; }
/** * Tests if a point is inside the circle defined by * the triangle with vertices a, b, c (oriented counter-clockwise). * This test uses simple * double-precision arithmetic, and thus may not be robust. * * @param a a vertex of the triangle * @param b a vertex of the triangle * @param c a vertex of the triangle * @param p the point to test * @return true if this point is inside the circle defined by the points a, b, c */ public static boolean isInCircleNonRobust( Coordinate a, Coordinate b, Coordinate c, Coordinate p) { boolean isInCircle = (a.x * a.x + a.y * a.y) * triArea(b, c, p) - (b.x * b.x + b.y * b.y) * triArea(a, c, p) + (c.x * c.x + c.y * c.y) * triArea(a, b, p) - (p.x * p.x + p.y * p.y) * triArea(a, b, c) > 0; return isInCircle; }