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, wait
containsPoint, disjoint, pointInTriangle, relateTriangle, within, withinTriangle
protected 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()
Component2D
getMinX
in interface Component2D
public double getMaxX()
Component2D
getMaxX
in interface Component2D
public double getMinY()
Component2D
getMinY
in interface Component2D
public double getMaxY()
Component2D
getMaxY
in interface Component2D
public boolean contains(double x, double y)
See https://www.ecse.rpi.edu/~wrf/Research/Short_Notes/pnpoly.html for more information.
contains
in interface Component2D
public PointValues.Relation relate(double minX, double maxX, double minY, double maxY)
Component2D
relate
in interface Component2D
public PointValues.Relation relateTriangle(double minX, double maxX, double minY, double maxY, double ax, double ay, double bx, double by, double cx, double cy)
Component2D
relateTriangle
in interface Component2D
public 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)
Component2D
withinTriangle
in interface Component2D
public static Component2D create(Polygon... polygons)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.