com.vividsolutions.jump.warp
Class Triangle

java.lang.Object
  extended by com.vividsolutions.jump.warp.Triangle

public class Triangle
extends java.lang.Object

A triangle, with special methods for use with BilinearInterpolatedTransform.

See Also:
BilinearInterpolatedTransform

Constructor Summary
Triangle(com.vividsolutions.jts.geom.Coordinate p1, com.vividsolutions.jts.geom.Coordinate p2, com.vividsolutions.jts.geom.Coordinate p3)
          Creates a Triangle.
 
Method Summary
 boolean contains(com.vividsolutions.jts.geom.Coordinate p)
          Returns whether this Triangle contains the given coordinate
 boolean equals(java.lang.Object o)
          Returns whether this Triangle has the same vertices as the given Triangle
 double getArea()
          Returns the area of the triangle.
 com.vividsolutions.jts.geom.Envelope getEnvelope()
          Returns the bounds of this Triangle.
 double getMaxSideLength()
          Returns the length of this Triangle's longest side.
 double getMinHeight()
          Returns the smallest of this Triangle's three heights (as measured perpendicularly from each side).
 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.
 int hashCode()
           
 boolean hasVertex(com.vividsolutions.jts.geom.Coordinate v)
          Returns whether v is one of this Triangle's vertices.
 java.util.List subTriangles(com.vividsolutions.jts.geom.Coordinate newVertex)
          Returns the three triangles that result from splitting this triangle at a given point.
 com.vividsolutions.jts.geom.Coordinate toEuclideanCoordinate(com.vividsolutions.jts.geom.Coordinate simplicialCoordinate)
          Converts from a simplicial coordinate to a Euclidean coordinate.
 com.vividsolutions.jts.geom.LinearRing toLinearRing()
          Converts this Triangle to a JTS Geometry.
 com.vividsolutions.jts.geom.Coordinate toSimplicialCoordinate(com.vividsolutions.jts.geom.Coordinate euclideanCoordinate)
          Converts from a Euclidean coordinate to a simplicial coordinate.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Triangle

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

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

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

getMinHeight

public double getMinHeight()
Returns the smallest of this Triangle's three heights (as measured perpendicularly from each side).

Returns:
the smallest of this Triangle's three altitudes

getArea

public double getArea()
Returns the area of the triangle. See http://www.mathcs.emory.edu/~rudolf/math108/summ1-2-3/node7.html

Returns:
the area of the triangle

getMaxSideLength

public double getMaxSideLength()
Returns the length of this Triangle's longest side.

Returns:
the length of this Triangle's longest side

toLinearRing

public com.vividsolutions.jts.geom.LinearRing toLinearRing()
Converts this Triangle to a JTS Geometry.

Returns:
a LinearRing with the same vertices as this Triangle

toString

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

contains

public boolean contains(com.vividsolutions.jts.geom.Coordinate p)
Returns whether this Triangle contains the given coordinate

Parameters:
p - the point to test for containment
Returns:
whether this Triangle contains the given coordinate

equals

public boolean equals(java.lang.Object o)
Returns whether this Triangle has the same vertices as the given Triangle

Overrides:
equals in class java.lang.Object
Parameters:
o - another Triangle; otherwise, equals will return false
Returns:
true if o is a Triangle and has the same vertices (though not necessarily in the same order)

hasVertex

public boolean hasVertex(com.vividsolutions.jts.geom.Coordinate v)
Returns whether v is one of this Triangle's vertices.

Parameters:
v - the candidate point
Returns:
whether v is equal to one of the vertices of this Triangle

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

subTriangles

public java.util.List subTriangles(com.vividsolutions.jts.geom.Coordinate newVertex)
Returns the three triangles that result from splitting this triangle at a given point.

Parameters:
newVertex - the split point, which must be inside triangle
Returns:
three Triangles resulting from splitting this triangle at the given Coordinate

toSimplicialCoordinate

public com.vividsolutions.jts.geom.Coordinate toSimplicialCoordinate(com.vividsolutions.jts.geom.Coordinate euclideanCoordinate)
Converts from a Euclidean coordinate to a simplicial coordinate.

Parameters:
euclideanCoordinate - the Euclidean coordinate
Returns:
a new 3D Coordinate with the corresponding simplicial values

toEuclideanCoordinate

public com.vividsolutions.jts.geom.Coordinate toEuclideanCoordinate(com.vividsolutions.jts.geom.Coordinate simplicialCoordinate)
Converts from a simplicial coordinate to a Euclidean coordinate.

Parameters:
simplicialCoordinate - the simplicial coordinate, which uses x, y, and z
Returns:
a new Coordinate with the corresponding Euclidean values

getEnvelope

public com.vividsolutions.jts.geom.Envelope getEnvelope()
Returns the bounds of this Triangle.

Returns:
the smallest Envelope enclosing this Triangle