public class Polygon2D extends Object implements Component2D
Loosely based on the algorithm described in http://www-ma2.upc.es/geoc/Schirra-pointPolygon.pdf.
Component2D.WithinRelation| Modifier and Type | Field and Description |
|---|---|
protected Component2D |
holes
tree of holes, or null
|
| Modifier | Constructor and Description |
|---|---|
protected |
Polygon2D(double minX,
double maxX,
double minY,
double maxY,
double[] x,
double[] y,
Component2D holes) |
protected |
Polygon2D(Polygon polygon,
Component2D holes) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(double x,
double y)
Returns true if the point is contained within this polygon.
|
static Component2D |
create(Polygon... polygons)
Builds a Polygon2D from multipolygon
|
double |
getMaxX()
max X value for the component
|
double |
getMaxY()
max Y value for the component
|
double |
getMinX()
min X value for the component
|
double |
getMinY()
min Y value for the component
|
PointValues.Relation |
relate(double minX,
double maxX,
double minY,
double maxY)
relates this component2D with a bounding box
|
PointValues.Relation |
relateTriangle(double minX,
double maxX,
double minY,
double maxY,
double ax,
double ay,
double bx,
double by,
double cx,
double cy)
relates this component2D with a triangle
|
Component2D.WithinRelation |
withinTriangle(double minX,
double maxX,
double minY,
double maxY,
double ax,
double ay,
boolean ab,
double bx,
double by,
boolean bc,
double cx,
double cy,
boolean ca)
Compute the within relation of this component2D with a triangle
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcontainsPoint, disjoint, pointInTriangle, relateTriangle, within, withinTriangleprotected final Component2D holes
protected Polygon2D(double minX,
double maxX,
double minY,
double maxY,
double[] x,
double[] y,
Component2D holes)
protected Polygon2D(Polygon polygon, Component2D holes)
public double getMinX()
Component2DgetMinX in interface Component2Dpublic double getMaxX()
Component2DgetMaxX in interface Component2Dpublic double getMinY()
Component2DgetMinY in interface Component2Dpublic double getMaxY()
Component2DgetMaxY in interface Component2Dpublic boolean contains(double x,
double y)
See https://www.ecse.rpi.edu/~wrf/Research/Short_Notes/pnpoly.html for more information.
contains in interface Component2Dpublic PointValues.Relation relate(double minX, double maxX, double minY, double maxY)
Component2Drelate in interface Component2Dpublic PointValues.Relation relateTriangle(double minX, double maxX, double minY, double maxY, double ax, double ay, double bx, double by, double cx, double cy)
Component2DrelateTriangle in interface Component2Dpublic Component2D.WithinRelation withinTriangle(double minX, double maxX, double minY, double maxY, double ax, double ay, boolean ab, double bx, double by, boolean bc, double cx, double cy, boolean ca)
Component2DwithinTriangle in interface Component2Dpublic static Component2D create(Polygon... polygons)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.