public class Triangle
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Coordinate |
p0
The coordinates of the vertices of the triangle
|
Coordinate |
p1
The coordinates of the vertices of the triangle
|
Coordinate |
p2
The coordinates of the vertices of the triangle
|
Constructor and Description |
---|
Triangle(Coordinate p0,
Coordinate p1,
Coordinate p2)
Creates a new triangle with the given vertices.
|
Modifier and Type | Method and Description |
---|---|
static Coordinate |
angleBisector(Coordinate a,
Coordinate b,
Coordinate c)
Computes the point at which the bisector of the angle ABC
cuts the segment AC.
|
static double |
area(Coordinate a,
Coordinate b,
Coordinate c)
Computes the 2D area of a triangle.
|
static double |
area3D(Coordinate a,
Coordinate b,
Coordinate c)
Computes the 3D area of a triangle.
|
static Coordinate |
centroid(Coordinate a,
Coordinate b,
Coordinate c)
Computes the centroid (centre of mass) of a triangle.
|
static Coordinate |
circumcentre(Coordinate a,
Coordinate b,
Coordinate c)
Computes the circumcentre of a triangle.
|
Coordinate |
inCentre()
Computes the incentre of a triangle.
|
static Coordinate |
inCentre(Coordinate a,
Coordinate b,
Coordinate c)
Computes the incentre of a triangle.
|
static boolean |
isAcute(Coordinate a,
Coordinate b,
Coordinate c)
Tests whether a triangle is acute.
|
static double |
longestSideLength(Coordinate a,
Coordinate b,
Coordinate c)
Computes the length of the longest side of a triangle
|
static HCoordinate |
perpendicularBisector(Coordinate a,
Coordinate b)
Computes the line which is the perpendicular bisector of the
line segment a-b.
|
static double |
signedArea(Coordinate a,
Coordinate b,
Coordinate c)
Computes the signed 2D area of a triangle.
|
public Coordinate p0
public Coordinate p1
public Coordinate p2
public Triangle(Coordinate p0, Coordinate p1, Coordinate p2)
p0
- a vertexp1
- a vertexp2
- a vertexpublic static boolean isAcute(Coordinate a, Coordinate b, Coordinate c)
Note: this implementation is not robust for angles very close to 90 degrees.
a
- a vertex of the triangleb
- a vertex of the trianglec
- a vertex of the trianglepublic static HCoordinate perpendicularBisector(Coordinate a, Coordinate b)
a
- a pointb
- another pointpublic static Coordinate circumcentre(Coordinate a, Coordinate b, Coordinate c)
a
- a vertx of the triangleb
- a vertx of the trianglec
- a vertx of the trianglepublic static Coordinate inCentre(Coordinate a, Coordinate b, Coordinate c)
a
- a vertx of the triangleb
- a vertx of the trianglec
- a vertx of the trianglepublic static Coordinate centroid(Coordinate a, Coordinate b, Coordinate c)
a
- a vertex of the triangleb
- a vertex of the trianglec
- a vertex of the trianglepublic static double longestSideLength(Coordinate a, Coordinate b, Coordinate c)
a
- a vertex of the triangleb
- a vertex of the trianglec
- a vertex of the trianglepublic static Coordinate angleBisector(Coordinate a, Coordinate b, Coordinate c)
a
- a vertex of the triangleb
- a vertex of the trianglec
- a vertex of the trianglepublic static double area(Coordinate a, Coordinate b, Coordinate c)
a
- a vertex of the triangleb
- a vertex of the trianglec
- a vertex of the trianglesignedArea
public static double signedArea(Coordinate a, Coordinate b, Coordinate c)
The signed area value can be used to determine point orientation, but
the implementation in this method
is susceptible to round-off errors.
Use CGAlgorithms#orientationIndex)
for robust orientation
calculation.
a
- a vertex of the triangleb
- a vertex of the trianglec
- a vertex of the triangleCGAlgorithms.orientationIndex(com.vividsolutions.jts.geom.Coordinate, com.vividsolutions.jts.geom.Coordinate, com.vividsolutions.jts.geom.Coordinate)
public static double area3D(Coordinate a, Coordinate b, Coordinate c)
a
- a vertex of the triangleb
- a vertex of the trianglec
- a vertex of the trianglepublic Coordinate inCentre()