+ /**
+ * Checks if point is on the right side of the line.
+ * @param point point to check
+ * @param lineP1 line start point
+ * @param lineP2 line end point
+ * @return true if point is on the right side of the line
+ */
+ private static boolean intersectsLine(final Point2D point, Point2D lineP1,
+ Point2D lineP2) {
+
+ // Sort line points by y coordinate.
+ if (lineP1.y > lineP2.y) {
+ final Point2D tmp = lineP1;
+ lineP1 = lineP2;
+ lineP2 = tmp;