@Override public boolean contains(Rectangle2D r) { return path.contains(r); }
@Override public boolean contains(double x, double y) { return shape.contains(x, y); }
@Override public boolean contains(Point2D p) { return path.contains(p); }
@Override public boolean contains(double x, double y) { return path.contains(x, y); }
@Override public boolean contains(Rectangle2D r) { return path.contains(r); }
@Override public boolean contains(Point2D p) { return path.contains(p); }
@Override public boolean contains(double x, double y) { return path.contains(x, y); }
public BodyLocation locationUnderPoint(double x, double y) { final double scaledX = x / scale; final double scaledY = y / scale; return locShapes.entrySet().stream() .filter(entry -> entry.getValue().contains(scaledX, scaledY)).findAny() .map(entry -> entry.getKey()).orElse(BodyLocation.GENERIC); }
public Set<XYDataPoint> getDataPointsIn(Path2D path) { HashSet<XYDataPoint> points = new HashSet<XYDataPoint>(); for (XYSeries series : seriesMap.values()) { Collection<XYDataPoint> dataPoints = series.getDataPoints(); for(XYDataPoint dataPoint : dataPoints) { if(path.contains(dataPoint.getX(), dataPoint.getY())) { points.add(dataPoint); } } } return points; }
private boolean pointInPolygon(Point p, Path2D awtPolygon) { return awtPolygon.contains(p.getX(), p.getY()); }
private boolean pointInPolygon(Point p, Path2D awtPolygon) { return awtPolygon.contains(p.getX(), p.getY()); }
public void mouseClicked(MouseEvent e) { Point p = e.getPoint(); System.out.println(prettyPoly.contains(p));
//This defines your polygon Double xCoord[] = {1.00121,2,3.5464,5,9,-5}; Double yCoord[] = {18.147,-32,1,100,-100.32,0}; Path2D myPolygon = new Path2D.Double(); //Here you append all of your points to the polygon for(int i = 0; i < xCoord.length; i++) { myPolygon.moveTo(xCoord[i], yCoord[i]); } myPolygon.closePath(); //Now we want to know if the point x, y is inside the Polygon: Double x; //The x coord Double y; //The y coord Boolean isInside = myPolygon.contains(x,y);
if (myShape != null && myShape.contains(e.getPoint())) { pressed = true; this.point = e.getPoint();
/** * Fetches the object, if any, that is rendered at {@code (x, y)}. * * @param x the x-coordinate. * @param y the y-coordinate. * * @return The object (or {@code null}). */ public Object3D fetchObjectAt(double x, double y) { for (int i = this.faces.size() - 1; i >= 0; i--) { Face f = this.faces.get(i); if (f instanceof LabelFace) { Rectangle2D bounds = (Rectangle2D) f.getOwner().getProperty("labelBounds"); if (bounds != null && bounds.contains(x - dx, y - dy)) { return f.getOwner(); } } else { Path2D p = f.createPath(this.projPts); if (p.contains(x - dx, y - dy)) { return f.getOwner(); } } } return null; }
if (path.contains(center.getOrdinate(0) + 180.0, center.getOrdinate(1) + 90.0)) { Rectangle2D r = path.getBounds2D(); if ((r.getMaxX() - r.getMinX()) > 359.0) {
if (path.contains(center.getOrdinate(0) + 180.0, center.getOrdinate(1) + 90.0)) { Rectangle2D r = path.getBounds2D(); if ((r.getMaxX() - r.getMinX()) > 359.0) {