List of usage examples for java.awt.geom Path2D contains
public final boolean contains(Rectangle2D r)
This method object may conservatively return false in cases where the specified rectangular area intersects a segment of the path, but that segment does not represent a boundary between the interior and exterior of the path.
From source file:inflor.core.gates.ui.PolygonGateAnnotation.java
@Override public boolean containsPoint(Point2D p) { Path2D poly = new Path2D.Double(); for (int i = 0; i < polygonPoints.length; i += 2) { if (i == 0) { poly.moveTo(polygonPoints[i], polygonPoints[i + 1]); } else {//from w ww . j av a 2 s . c om poly.lineTo(polygonPoints[i], polygonPoints[i + 1]); } } poly.closePath(); return poly.contains(p); }