Package org.locationtech.jts.jump.warp
Class Triangle
- java.lang.Object
-
- org.locationtech.jts.jump.warp.Triangle
-
public class Triangle extends Object
A triangle, with special methods for use with BilinearInterpolatedTransform.- See Also:
BilinearInterpolatedTransform
-
-
Constructor Summary
Constructors Constructor Description Triangle(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p3)Creates a Triangle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(org.locationtech.jts.geom.Coordinate p)Returns whether this Triangle contains the given coordinatebooleanequals(Object o)Returns whether this Triangle has the same vertices as the given TriangledoublegetArea()Returns the area of the triangle.org.locationtech.jts.geom.EnvelopegetEnvelope()Returns the bounds of this Triangle.doublegetMaxSideLength()Returns the length of this Triangle's longest side.doublegetMinHeight()Returns the smallest of this Triangle's three heights (as measured perpendicularly from each side).org.locationtech.jts.geom.CoordinategetP1()Returns the first vertex.org.locationtech.jts.geom.CoordinategetP2()Returns the second vertex.org.locationtech.jts.geom.CoordinategetP3()Returns the third vertex.inthashCode()booleanhasVertex(org.locationtech.jts.geom.Coordinate v)Returns whether v is one of this Triangle's vertices.protected org.locationtech.jts.geom.Coordinatemin(org.locationtech.jts.geom.Coordinate a, org.locationtech.jts.geom.Coordinate b)ListsubTriangles(org.locationtech.jts.geom.Coordinate newVertex)Returns the three triangles that result from splitting this triangle at a given point.org.locationtech.jts.geom.CoordinatetoEuclideanCoordinate(org.locationtech.jts.geom.Coordinate simplicialCoordinate)Converts from a simplicial coordinate to a Euclidean coordinate.org.locationtech.jts.geom.LinearRingtoLinearRing()Converts this Triangle to a JTS Geometry.org.locationtech.jts.geom.CoordinatetoSimplicialCoordinate(org.locationtech.jts.geom.Coordinate euclideanCoordinate)Converts from a Euclidean coordinate to a simplicial coordinate.StringtoString()
-
-
-
Method Detail
-
getP1
public org.locationtech.jts.geom.Coordinate getP1()
Returns the first vertex.- Returns:
- the first vertex
-
getP2
public org.locationtech.jts.geom.Coordinate getP2()
Returns the second vertex.- Returns:
- the second vertex
-
getP3
public org.locationtech.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 org.locationtech.jts.geom.LinearRing toLinearRing()
Converts this Triangle to a JTS Geometry.- Returns:
- a LinearRing with the same vertices as this Triangle
-
contains
public boolean contains(org.locationtech.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(Object o)
Returns whether this Triangle has the same vertices as the given Triangle
-
hasVertex
public boolean hasVertex(org.locationtech.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
-
subTriangles
public List subTriangles(org.locationtech.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
-
min
protected org.locationtech.jts.geom.Coordinate min(org.locationtech.jts.geom.Coordinate a, org.locationtech.jts.geom.Coordinate b)
-
toSimplicialCoordinate
public org.locationtech.jts.geom.Coordinate toSimplicialCoordinate(org.locationtech.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 org.locationtech.jts.geom.Coordinate toEuclideanCoordinate(org.locationtech.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 org.locationtech.jts.geom.Envelope getEnvelope()
Returns the bounds of this Triangle.- Returns:
- the smallest Envelope enclosing this Triangle
-
-