GEOS  3.9.1dev
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
geos::geom::Triangle Class Reference

Represents a planar triangle, and provides methods for calculating various properties of triangles. More...

#include <Triangle.h>

Collaboration diagram for geos::geom::Triangle:
[legend]

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 ()
 

Static Public Member Functions

static const Coordinate circumcentre (const Coordinate &p0, const Coordinate &p1, const Coordinate &p2)
 Computes the circumcentre of a triangle. More...
 

Public Attributes

Coordinate p0
 
Coordinate p1
 
Coordinate p2
 

Private Member Functions

double det (double m00, double m01, double m10, double m11) const
 

Detailed Description

Represents a planar triangle, and provides methods for calculating various properties of triangles.

Definition at line 31 of file Triangle.h.

Constructor & Destructor Documentation

geos::geom::Triangle::Triangle ( const Coordinate nP0,
const Coordinate nP1,
const Coordinate nP2 
)
inline

Definition at line 35 of file Triangle.h.

Member Function Documentation

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).

Parameters
resultPointthe point into which to write the inCentre of the triangle
static const Coordinate geos::geom::Triangle::circumcentre ( const Coordinate p0,
const Coordinate p1,
const Coordinate p2 
)
static

Computes the circumcentre of a triangle.

void geos::geom::Triangle::circumcentreDD ( Coordinate resultPoint)
double geos::geom::Triangle::det ( double  m00,
double  m01,
double  m10,
double  m11 
) const
private

Computes the determinant of a 2x2 matrix. Uses standard double-precision arithmetic, so is susceptible to round-off error.

Parameters
m00the [0,0] entry of the matrix
m01the [0,1] entry of the matrix
m10the [1,0] entry of the matrix
m11the [1,1] entry of the matrix
Returns
the determinant
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.

Parameters
resultPointthe point into which to write the inCentre of the triangle
bool geos::geom::Triangle::isIsoceles ( )

Member Data Documentation

Coordinate geos::geom::Triangle::p0

Definition at line 33 of file Triangle.h.

Coordinate geos::geom::Triangle::p1

Definition at line 33 of file Triangle.h.

Coordinate geos::geom::Triangle::p2

Definition at line 33 of file Triangle.h.


The documentation for this class was generated from the following file: