org.osm2world.core.math
public class SimplePolygonXZ extends PolygonXZ implements SimpleClosedShapeXZ
vertexLoop
Constructor and Description |
---|
SimplePolygonXZ(List<VectorXZ> vertexLoop) |
Modifier and Type | Method and Description |
---|---|
PolygonWithHolesXZ |
asPolygonWithHolesXZ() |
SimplePolygonXZ |
asSimplePolygon()
returns a polygon with the coordinates of this polygon
that is an instance of
SimplePolygonXZ . |
static boolean |
contains(List<VectorXZ> polygonVertexLoop,
VectorXZ test)
returns true if the polygon defined by the polygonVertexLoop parameter
contains a given position
|
boolean |
contains(PolygonXZ p)
returns true if this polygon contains the parameter polygon
|
boolean |
contains(VectorXZ test)
returns true if the polygon contains a given position
|
double |
distanceToSegments(VectorXZ p)
returns the distance of a point to the segments this polygon.
|
boolean |
equals(Object obj) |
double |
getArea()
returns the polygon's area
|
VectorXZ |
getCentroid()
returns the centroid (or "barycenter") of the polygon
|
double |
getDiameter()
returns the largest distance between any pair of vertices
of this polygon
|
List<LineSegmentXZ> |
getSegments() |
SimplePolygonXZ |
getSimplifiedPolygon()
returns a different polygon that is constructed from this polygon
by removing all vertices where this has an angle close to 180°
(i.e.
|
Collection<TriangleXZ> |
getTriangulation()
returns a decomposition of the shape into triangles.
|
int |
hashCode() |
boolean |
isClockwise()
returns true if the polygon has clockwise orientation
|
boolean |
isSelfIntersecting()
returns whether this polygon is self-intersecting
|
boolean |
isSimple()
checks whether this polygon is simple
|
SimplePolygonXZ |
makeClockwise()
returns this polygon if it is counterclockwise,
or the reversed polygon if it is clockwise.
|
SimplePolygonXZ |
makeCounterclockwise()
returns this polygon if it is clockwise,
or the reversed polygon if it is counterclockwise.
|
SimplePolygonXZ |
reverse() |
SimplePolygonXZ |
shift(VectorXZ shiftVector)
creates a new polygon by adding a shift vector to each vector of this
|
assertLoopProperty, asTriangleXZ, getCenter, getClosestSegment, getOutlineLength, getVertex, getVertexAfter, getVertexBefore, getVertexCollection, getVertexList, getVertexLoop, getVertices, intersectionPositions, intersectionSegments, intersects, intersects, intersects, isEquivalentTo, isSelfIntersecting, size, toString, xyz
getVertexList
public SimplePolygonXZ(List<VectorXZ> vertexLoop)
vertexLoop
- vertices defining the polygon;
first and last vertex must be equalInvalidGeometryException
- if the polygon is self-intersecting
or produces invalid area calculation resultspublic List<LineSegmentXZ> getSegments()
getSegments
in class PolygonXZ
public double getArea()
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public VectorXZ getCentroid()
public double getDiameter()
public boolean isClockwise()
public boolean isSelfIntersecting()
PolygonXZ
isSelfIntersecting
in class PolygonXZ
public boolean isSimple()
PolygonXZ
public SimplePolygonXZ asSimplePolygon()
PolygonXZ
SimplePolygonXZ
.
Only works if it actually PolygonXZ.isSimple()
!asSimplePolygon
in class PolygonXZ
public PolygonWithHolesXZ asPolygonWithHolesXZ()
PolygonWithHolesXZ
with this polygon as the outer polygon and no holespublic SimplePolygonXZ makeClockwise()
public SimplePolygonXZ makeCounterclockwise()
public SimplePolygonXZ reverse()
public SimplePolygonXZ shift(VectorXZ shiftVector)
public static boolean contains(List<VectorXZ> polygonVertexLoop, VectorXZ test)
public boolean contains(VectorXZ test)
public boolean contains(PolygonXZ p)
public double distanceToSegments(VectorXZ p)
public SimplePolygonXZ getSimplifiedPolygon()
public Collection<TriangleXZ> getTriangulation()
SimpleClosedShapeXZ
getTriangulation
in interface SimpleClosedShapeXZ