Class Triangle
java.lang.Object
com.vividsolutions.jump.warp.Triangle
A triangle, with special methods for use with BilinearInterpolatedTransform.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTriangle(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p3) Creates a Triangle. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(org.locationtech.jts.geom.Coordinate p) Returns whether this Triangle contains the given coordinatebooleanReturns whether this Triangle has the same vertices as the given TriangledoublegetArea()Returns the area of the triangle.org.locationtech.jts.geom.EnvelopeReturns the bounds of this Triangle.doubleReturns the length of this Triangle's longest side.doubleReturns 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) subTriangles(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.LinearRingConverts 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.toString()
-
Constructor Details
-
Triangle
public Triangle(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p3) Creates a Triangle.- Parameters:
p1- one vertexp2- another vertexp3- another vertex
-
-
Method Details
-
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
-
toString
-
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
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
-
hashCode
-
subTriangles
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
-