com.vividsolutions.jump.warp
Class Quadrilateral

java.lang.Object
  extended by com.vividsolutions.jump.warp.Quadrilateral
All Implemented Interfaces:
java.lang.Cloneable

public class Quadrilateral
extends java.lang.Object
implements java.lang.Cloneable

A simple four-sided polygon.


Constructor Summary
Quadrilateral(com.vividsolutions.jts.geom.Coordinate p1, com.vividsolutions.jts.geom.Coordinate p2, com.vividsolutions.jts.geom.Coordinate p3, com.vividsolutions.jts.geom.Coordinate p4)
          Creates a Quadrilateral.
 
Method Summary
 com.vividsolutions.jts.geom.Envelope getEnvelope()
           
 com.vividsolutions.jts.geom.Coordinate getP1()
          Returns the first vertex.
 com.vividsolutions.jts.geom.Coordinate getP2()
          Returns the second vertex.
 com.vividsolutions.jts.geom.Coordinate getP3()
          Returns the third vertex.
 com.vividsolutions.jts.geom.Coordinate getP4()
          Returns the fourth vertex.
 boolean isConvex()
          Returns whether this Quadrilateral is a convex polygon.
 com.vividsolutions.jts.geom.Polygon toPolygon()
          Converts this Quadrilateral to a JTS Polygon.
 java.lang.String toString()
           
 java.util.List triangles()
          Creates two Triangles from this Quadrilateral.
 java.util.Collection verticesOutside(java.util.Collection vertices)
          Filters out points that lie inside this Quadrilateral
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Quadrilateral

public Quadrilateral(com.vividsolutions.jts.geom.Coordinate p1,
                     com.vividsolutions.jts.geom.Coordinate p2,
                     com.vividsolutions.jts.geom.Coordinate p3,
                     com.vividsolutions.jts.geom.Coordinate p4)
Creates a Quadrilateral.

Parameters:
p1 - one vertex
p2 - another vertex
p3 - another vertex
p4 - another vertex
Method Detail

getEnvelope

public com.vividsolutions.jts.geom.Envelope getEnvelope()

isConvex

public boolean isConvex()
Returns whether this Quadrilateral is a convex polygon.

Returns:
whether the diagonals intersect

triangles

public java.util.List triangles()
Creates two Triangles from this Quadrilateral.

Returns:
two Triangles: P1-P2-P3 and P1-P4-P3

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getP1

public com.vividsolutions.jts.geom.Coordinate getP1()
Returns the first vertex.

Returns:
the first vertex

getP2

public com.vividsolutions.jts.geom.Coordinate getP2()
Returns the second vertex.

Returns:
the second vertex

getP3

public com.vividsolutions.jts.geom.Coordinate getP3()
Returns the third vertex.

Returns:
the third vertex

getP4

public com.vividsolutions.jts.geom.Coordinate getP4()
Returns the fourth vertex.

Returns:
the fourth vertex

toPolygon

public com.vividsolutions.jts.geom.Polygon toPolygon()
Converts this Quadrilateral to a JTS Polygon.

Returns:
a new JTS Polygon with one shell and no holes

verticesOutside

public java.util.Collection verticesOutside(java.util.Collection vertices)
Filters out points that lie inside this Quadrilateral

Parameters:
vertices - points to check
Returns:
those points which lie outside this Quadrilateral