org.osm2world.core.math
Class SimplePolygonXZ

Object
  extended by PolygonXZ
      extended by SimplePolygonXZ

public class SimplePolygonXZ
extends PolygonXZ

a non-self-intersecting polygon in the XZ plane


Field Summary
 
Fields inherited from class PolygonXZ
vertexLoop
 
Constructor Summary
SimplePolygonXZ(List<VectorXZ> vertexLoop)
           
 
Method Summary
 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 getArea()
          returns the polygon's area
 List<LineSegmentXZ> getSegments()
           
 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()
           
 
Methods inherited from class PolygonXZ
assertLoopProperty, asTriangleXZ, getCenter, getOutlineLength, getVertexLoop, getVertices, intersectionPositions, intersects, intersects, intersects, isEquivalentTo, isSelfIntersecting, size, toString, xyz
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimplePolygonXZ

public SimplePolygonXZ(List<VectorXZ> vertexLoop)
Parameters:
vertexLoop - vertices defining the polygon; first and last vertex must be equal
Throws:
InvalidGeometryException - if the polygon is self-intersecting or produces invalid area calculation results
Method Detail

getSegments

public List<LineSegmentXZ> getSegments()
Overrides:
getSegments in class PolygonXZ

getArea

public double getArea()
returns the polygon's area


isClockwise

public boolean isClockwise()
returns true if the polygon has clockwise orientation


isSelfIntersecting

public boolean isSelfIntersecting()
Description copied from class: PolygonXZ
returns whether this polygon is self-intersecting

Overrides:
isSelfIntersecting in class PolygonXZ

isSimple

public boolean isSimple()
Description copied from class: PolygonXZ
checks whether this polygon is simple

Overrides:
isSimple in class PolygonXZ

asSimplePolygon

public SimplePolygonXZ asSimplePolygon()
Description copied from class: PolygonXZ
returns a polygon with the coordinates of this polygon that is an instance of SimplePolygonXZ. Only works if it actually PolygonXZ.isSimple()!

Overrides:
asSimplePolygon in class PolygonXZ

asPolygonWithHolesXZ

public PolygonWithHolesXZ asPolygonWithHolesXZ()
Returns:
a PolygonWithHolesXZ with this polygon as the outer polygon and no holes

makeClockwise

public SimplePolygonXZ makeClockwise()
returns this polygon if it is counterclockwise, or the reversed polygon if it is clockwise.


makeCounterclockwise

public SimplePolygonXZ makeCounterclockwise()
returns this polygon if it is clockwise, or the reversed polygon if it is counterclockwise.


reverse

public SimplePolygonXZ reverse()
Overrides:
reverse in class PolygonXZ

contains

public static boolean contains(List<VectorXZ> polygonVertexLoop,
                               VectorXZ test)
returns true if the polygon defined by the polygonVertexLoop parameter contains a given position


contains

public boolean contains(VectorXZ test)
returns true if the polygon contains a given position


contains

public boolean contains(PolygonXZ p)
returns true if this polygon contains the parameter polygon