GEOS 3.11.1
|
Represents a planar triangle, and provides methods for calculating various properties of triangles. More...
#include <Triangle.h>
Public Member Functions | |
Triangle (const Coordinate &nP0, const Coordinate &nP1, const Coordinate &nP2) | |
void | inCentre (Coordinate &resultPoint) |
The inCentre of a triangle is the point which is equidistant from the sides of the triangle. More... | |
void | circumcentre (Coordinate &resultPoint) |
Computes the circumcentre of a triangle. More... | |
void | circumcentreDD (Coordinate &resultPoint) |
bool | isIsoceles () |
bool | intersects (const Coordinate &p) |
bool | isCCW () |
bool | isAcute () |
double | length () const |
double | area () const |
Static Public Member Functions | |
static const Coordinate | circumcentre (const Coordinate &p0, const Coordinate &p1, const Coordinate &p2) |
static bool | isAcute (const Coordinate &a, const Coordinate &b, const Coordinate &c) |
static bool | isCCW (const Coordinate &a, const Coordinate &b, const Coordinate &c) |
static bool | intersects (const Coordinate &a, const Coordinate &b, const Coordinate &c, const Coordinate &p) |
static double | longestSideLength (const Coordinate &a, const Coordinate &b, const Coordinate &c) |
static double | length (const Coordinate &a, const Coordinate &b, const Coordinate &c) |
static double | area (const Coordinate &a, const Coordinate &b, const Coordinate &c) |
Public Attributes | |
Coordinate | p0 |
Coordinate | p1 |
Coordinate | p2 |
Represents a planar triangle, and provides methods for calculating various properties of triangles.
|
static |
Computes the 2D area of a triangle. The area value is always non-negative.
a | vertex of the triangle |
b | vertex of the triangle |
c | vertex of the triangle |
|
static |
Computes the circumcentre of a triangle.
void geos::geom::Triangle::circumcentre | ( | Coordinate & | resultPoint | ) |
Computes the circumcentre of a triangle.
The circumcentre is the centre of the circumcircle, the smallest circle which encloses the triangle. It is also the common intersection point of the perpendicular bisectors of the sides of the triangle, and is the only point which has equal distance to all three vertices of the triangle.
The circumcentre does not necessarily lie within the triangle. For example, the circumcentre of an obtuse isoceles triangle lies outside the triangle.
This method uses an algorithm due to J.R.Shewchuk which uses normalization to the origin to improve the accuracy of computation. (See Lecture Notes on Geometric Robustness, Jonathan Richard Shewchuk, 1999).
resultPoint | the point into which to write the inCentre of the triangle |
void geos::geom::Triangle::inCentre | ( | Coordinate & | resultPoint | ) |
The inCentre of a triangle is the point which is equidistant from the sides of the triangle.
This is also the point at which the bisectors of the angles meet.
resultPoint | the point into which to write the inCentre of the triangle |
|
static |
Tests whether a triangle intersects a point.
a | a vertex of the triangle |
b | a vertex of the triangle |
c | a vertex of the triangle |
p | the point to test |
|
inline |
Tests whether a triangle intersects a point.
p | the point to test |
References intersects().
Referenced by intersects().
|
inline |
|
static |
Tests whether a triangle is acute. A triangle is acute if all interior angles are acute. This is a strict test - right triangles will return false
. A triangle which is not acute is either right or obtuse.
Note: this implementation is not robust for angles very close to 90 degrees.
a | a vertex of the triangle |
b | a vertex of the triangle |
c | a vertex of the triangle |
|
inline |
|
static |
Tests whether a triangle is oriented counter-clockwise.
a | a vertex of the triangle |
b | a vertex of the triangle |
c | a vertex of the triangle |
double geos::geom::Triangle::length | ( | ) | const |
Computes the length of the perimeter of this triangle.
|
static |
Compute the length of the perimeter of a triangle
a | a vertex of the triangle |
b | a vertex of the triangle |
c | a vertex of the triangle |
|
static |
Computes the length of the longest side of a triangle
a | a vertex of the triangle |
b | a vertex of the triangle |
c | a vertex of the triangle |