Class TrianglePredicate
Algorithms for computing values and predicates associated with triangles.
Inherited Members
Namespace: NetTopologySuite.Triangulate.QuadEdge
Assembly: NetTopologySuite.dll
Syntax
public static class TrianglePredicate
Remarks
For some algorithms extended-precision implementations are provided, which are more robust (i.e. they produce correct answers in more cases). Also, some more robust formulations of some algorithms are provided, which utilize normalization to the origin.
Methods
| Edit this page View SourceIsInCircleCC(Coordinate, Coordinate, Coordinate, Coordinate)
Computes the inCircle test using distance from the circumcentre. Uses standard double-precision arithmetic.
Declaration
public static bool IsInCircleCC(Coordinate a, Coordinate b, Coordinate c, Coordinate p)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | a | A vertex of the triangle |
Coordinate | b | A vertex of the triangle |
Coordinate | c | A vertex of the triangle |
Coordinate | p | The point to test |
Returns
Type | Description |
---|---|
bool | The area of a triangle defined by the points a, b and c |
Remarks
In general this doesn't appear to be any more robust than the standard calculation. However, there is at least one case where the test point is far enough from the circumcircle that this test gives the correct answer.
LINESTRING (1507029.9878 518325.7547, 1507022.1120341457 518332.8225183258, 1507029.9833 518325.7458, 1507029.9896965567 518325.744909031)
IsInCircleDDFast(Coordinate, Coordinate, Coordinate, Coordinate)
Tests if a point is inside the circle defined by the triangle with vertices a, b, c (oriented counter-clockwise).
Declaration
public static bool IsInCircleDDFast(Coordinate a, Coordinate b, Coordinate c, Coordinate p)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | a | A vertex of the triangle |
Coordinate | b | A vertex of the triangle |
Coordinate | c | A vertex of the triangle |
Coordinate | p | The point to test |
Returns
Type | Description |
---|---|
bool | true if this point is inside the circle defined by the points a, b, c |
Remarks
The computation uses DD arithmetic for robustness, but a faster approach.
IsInCircleDDNormalized(Coordinate, Coordinate, Coordinate, Coordinate)
Declaration
public static bool IsInCircleDDNormalized(Coordinate a, Coordinate b, Coordinate c, Coordinate p)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | a | |
Coordinate | b | |
Coordinate | c | |
Coordinate | p |
Returns
Type | Description |
---|---|
bool |
IsInCircleNonRobust(Coordinate, Coordinate, Coordinate, Coordinate)
Tests if a point is inside the circle defined by the triangle with vertices a, b, c (oriented counter-clockwise). This test uses simple double-precision arithmetic, and thus is not 100% robust.
Declaration
public static bool IsInCircleNonRobust(Coordinate a, Coordinate b, Coordinate c, Coordinate p)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | a | A vertex of the triangle |
Coordinate | b | A vertex of the triangle |
Coordinate | c | A vertex of the triangle |
Coordinate | p | The point to test |
Returns
Type | Description |
---|---|
bool | true if this point is inside the circle defined by the points a, b, c |
IsInCircleNormalized(Coordinate, Coordinate, Coordinate, Coordinate)
Tests if a point is inside the circle defined by the triangle with vertices a, b, c (oriented counter-clockwise).
Declaration
public static bool IsInCircleNormalized(Coordinate a, Coordinate b, Coordinate c, Coordinate p)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | a | A vertex of the triangle |
Coordinate | b | A vertex of the triangle |
Coordinate | c | A vertex of the triangle |
Coordinate | p | The point to test |
Returns
Type | Description |
---|---|
bool | true if this point is inside the circle defined by the points a, b, c |
Remarks
This test uses simple double-precision arithmetic, and thus is not 100% robust. However, by using normalization to the origin it provides improved robustness and increased performance.
Based on code by J.R.Shewchuk.
IsInCircleRobust(Coordinate, Coordinate, Coordinate, Coordinate)
Tests if a point is inside the circle defined by the triangle with vertices a, b, c (oriented counter-clockwise).
Declaration
public static bool IsInCircleRobust(Coordinate a, Coordinate b, Coordinate c, Coordinate p)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | a | A vertex of the triangle |
Coordinate | b | A vertex of the triangle |
Coordinate | c | A vertex of the triangle |
Coordinate | p | The point to test |
Returns
Type | Description |
---|---|
bool | true if this point is inside the circle defined by the points a, b, c |
Remarks
This method uses more robust computation.