NetTopologySuite
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
NetTopologySuite.Geometries.Triangle Class Reference

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

Public Member Functions

 Triangle (Coordinate p0, Coordinate p1, Coordinate p2)
 Creates a new triangle with the given vertices. More...
 
Coordinate InCentre ()
 Computes the InCentre of this triangle More...
 
bool IsAcute ()
 Tests whether this triangle is acute. A triangle is acute iff 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. More...
 
Coordinate Circumcentre ()
 Computes the circumcentre of this 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. 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). More...
 
Coordinate Centroid ()
 Computes the centroid (centre of mass) of this triangle. This is also the point at which the triangle's three medians intersect (a triangle median is the segment from a vertex of the triangle to the midpoint of the opposite side). The centroid divides each median in a ratio of 2:1. The centroid always lies within the triangle. More...
 
double LongestSideLength ()
 Computes the length of the longest side of this triangle More...
 
double Area ()
 Computes the 2D area of this triangle. The area value is always non-negative. More...
 
double SignedArea ()
 Computes the signed 2D area of this triangle. The area value is positive if the triangle is oriented CW, and negative if it is oriented CCW. 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(Coordinate, Coordinate, Coordinate) for robust orientation calculation. More...
 
double Area3D ()
 Computes the 3D area of this triangle. The value computed is alway non-negative. More...
 
double InterpolateZ (Coordinate p)
 Computes the Z-value (elevation) of an XY point on a three-dimensional plane defined by this triangle (whose vertices must have Z-values). This triangle must not be degenerate (in other words, the triangle must enclose a non-zero area), and must not be parallel to the Z-axis. This method can be used to interpolate the Z-value of a point inside this triangle (for example, of a TIN facet with elevations on the vertices). More...
 

Static Public Member Functions

static Boolean IsAcute (Coordinate a, Coordinate b, Coordinate c)
 Tests whether a triangle is acute. A triangle is acute iff 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. More...
 
static HCoordinate PerpendicularBisector (Coordinate a, Coordinate b)
 
static Coordinate Circumcentre (Coordinate a, Coordinate b, Coordinate c)
 
static Coordinate InCentre (Coordinate a, Coordinate b, Coordinate c)
 
static Coordinate Centroid (Coordinate a, Coordinate b, Coordinate c)
 
static double LongestSideLength (Coordinate a, Coordinate b, Coordinate c)
 
static Coordinate AngleBisector (Coordinate a, Coordinate b, Coordinate c)
 
static double Area (Coordinate a, Coordinate b, Coordinate c)
 
static double SignedArea (Coordinate a, Coordinate b, Coordinate c)
 
static double Area3D (Coordinate a, Coordinate b, Coordinate c)
 
static double InterpolateZ (Coordinate p, Coordinate v0, Coordinate v1, Coordinate v2)
 Computes the Z-value (elevation) of an XY point on a three-dimensional plane defined by a triangle whose vertices have Z-values. The defining triangle must not be degenerate (in other words, the triangle must enclose a non-zero area), and must not be parallel to the Z-axis. This method can be used to interpolate the Z-value of a point inside a triangle (for example, of a TIN facet with elevations on the vertices). More...
 

Properties

Coordinate P0 [get, set]
 A corner point of the triangle More...
 
Coordinate P1 [get, set]
 A corner point of the triangle More...
 
Coordinate P2 [get, set]
 A corner point of the triangle More...
 

Detailed Description

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

Constructor & Destructor Documentation

NetTopologySuite.Geometries.Triangle.Triangle ( Coordinate  p0,
Coordinate  p1,
Coordinate  p2 
)

Creates a new triangle with the given vertices.

Parameters
p0A vertex
p1A vertex
p2A vertex

Member Function Documentation

static Coordinate NetTopologySuite.Geometries.Triangle.AngleBisector ( Coordinate  a,
Coordinate  b,
Coordinate  c 
)
static

summary> Computes the 2D area of a triangle. The area value is always non-negative. /summary>

Parameters
aA vertex of the triangle
bA vertex of the triangle
cA vertex of the triangle
Returns
The area of the triangle
See also
SignedArea
static double NetTopologySuite.Geometries.Triangle.Area ( Coordinate  a,
Coordinate  b,
Coordinate  c 
)
static

summary> Computes the signed 2D area of a triangle. /summary>

The area value is positive if the triangle is oriented CW, and negative if it is oriented CCW.

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.

Parameters
aA vertex of the triangle
bA vertex of the triangle
cA vertex of the triangle
Returns
The area of the triangle
See also
Area, CGAlgorithms.OrientationIndex
double NetTopologySuite.Geometries.Triangle.Area ( )

Computes the 2D area of this triangle. The area value is always non-negative.

Returns
The area of this triangle
See also
SignedArea()
double NetTopologySuite.Geometries.Triangle.Area3D ( )

Computes the 3D area of this triangle. The value computed is alway non-negative.

Returns
The 3D area of this triangle
static Coordinate NetTopologySuite.Geometries.Triangle.Centroid ( Coordinate  a,
Coordinate  b,
Coordinate  c 
)
static

summary>Computes the length of the longest side of a triangle

Parameters
aA vertex of the triangle
bA vertex of the triangle
cA vertex of the triangle
Returns
The length of the longest side of the triangle
Coordinate NetTopologySuite.Geometries.Triangle.Centroid ( )

Computes the centroid (centre of mass) of this triangle. This is also the point at which the triangle's three medians intersect (a triangle median is the segment from a vertex of the triangle to the midpoint of the opposite side). The centroid divides each median in a ratio of 2:1. The centroid always lies within the triangle.

Returns
The centroid of this triangle
Coordinate NetTopologySuite.Geometries.Triangle.Circumcentre ( )

Computes the circumcentre of this 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. 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).

Returns
The circumcentre of this triangle
static Coordinate NetTopologySuite.Geometries.Triangle.InCentre ( Coordinate  a,
Coordinate  b,
Coordinate  c 
)
static

summary>Computes the centroid (centre of mass) of a triangle.

This is also the point at which the triangle's three medians intersect (a triangle median is the segment from a vertex of the triangle to the midpoint of the opposite side). The centroid divides each median in a ratio of 2:1. The centroid always lies within the triangle.

Parameters
aA vertex of the triangle
bA vertex of the triangle
cA vertex of the triangle

returns>The centroid of the triangle

Coordinate NetTopologySuite.Geometries.Triangle.InCentre ( )

Computes the InCentre of this triangle

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. It is the centre of the triangle's InCircle, which is the unique circle that is tangent to each of the triangle's three sides.

Returns
The point which is the InCentre of the triangle.
static double NetTopologySuite.Geometries.Triangle.InterpolateZ ( Coordinate  p,
Coordinate  v0,
Coordinate  v1,
Coordinate  v2 
)
static

Computes the Z-value (elevation) of an XY point on a three-dimensional plane defined by a triangle whose vertices have Z-values. The defining triangle must not be degenerate (in other words, the triangle must enclose a non-zero area), and must not be parallel to the Z-axis. This method can be used to interpolate the Z-value of a point inside a triangle (for example, of a TIN facet with elevations on the vertices).

Parameters
pThe point to compute the Z-value of
v0A vertex of a triangle, with a Z ordinate
v1A vertex of a triangle, with a Z ordinate
v2A vertex of a triangle, with a Z ordinate
Returns
The computed Z-value (elevation) of the point
double NetTopologySuite.Geometries.Triangle.InterpolateZ ( Coordinate  p)

Computes the Z-value (elevation) of an XY point on a three-dimensional plane defined by this triangle (whose vertices must have Z-values). This triangle must not be degenerate (in other words, the triangle must enclose a non-zero area), and must not be parallel to the Z-axis. This method can be used to interpolate the Z-value of a point inside this triangle (for example, of a TIN facet with elevations on the vertices).

Parameters
pThe point to compute the Z-value of
Returns
The computed Z-value (elevation) of the point
static Boolean NetTopologySuite.Geometries.Triangle.IsAcute ( Coordinate  a,
Coordinate  b,
Coordinate  c 
)
static

Tests whether a triangle is acute. A triangle is acute iff 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.

Parameters
aA vertex of the triangle
bA vertex of the triangle
cA vertex of the triangle
Returns
True if the triangle is acute.

summary> Computes the line which is the perpendicular bisector of the /summary>

Parameters
aA point
bAnother point
Returns
The perpendicular bisector, as an HCoordinate line segment a-b.
bool NetTopologySuite.Geometries.Triangle.IsAcute ( )

Tests whether this triangle is acute. A triangle is acute iff 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.

Returns
true if this triangle is acute
static double NetTopologySuite.Geometries.Triangle.LongestSideLength ( Coordinate  a,
Coordinate  b,
Coordinate  c 
)
static

summary>Computes the point at which the bisector of the angle ABC cuts the segment AC.

Parameters
aA vertex of the triangle
bA vertex of the triangle
cA vertex of the triangle
Returns
The angle bisector cut point
double NetTopologySuite.Geometries.Triangle.LongestSideLength ( )

Computes the length of the longest side of this triangle

Returns
The length of the longest side of this triangle
static HCoordinate NetTopologySuite.Geometries.Triangle.PerpendicularBisector ( Coordinate  a,
Coordinate  b 
)
static

summary>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
aA vertex of the triangle
bA vertex of the triangle
cA vertex of the triangle
Returns
The circumcentre of the triangle
static double NetTopologySuite.Geometries.Triangle.SignedArea ( Coordinate  a,
Coordinate  b,
Coordinate  c 
)
static

summary> Computes the 3D area of a triangle. The value computed is alway non-negative. /summary>

Parameters
aA vertex of the triangle
bA vertex of the triangle
cA vertex of the triangle
Returns
The 3D area of the triangle
double NetTopologySuite.Geometries.Triangle.SignedArea ( )

Computes the signed 2D area of this triangle. The area value is positive if the triangle is oriented CW, and negative if it is oriented CCW. 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(Coordinate, Coordinate, Coordinate) for robust orientation calculation.

Returns
The signed 2D area of this triangle
See also
CGAlgorithms.OrientationIndex(Coordinate, Coordinate, Coordinate)

Property Documentation

Coordinate NetTopologySuite.Geometries.Triangle.P0
getset

A corner point of the triangle

Coordinate NetTopologySuite.Geometries.Triangle.P1
getset

A corner point of the triangle

Coordinate NetTopologySuite.Geometries.Triangle.P2
getset

A corner point of the triangle


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