Class: TrianglePredicate

jsts.triangulate.quadedge.TrianglePredicate

new TrianglePredicate()

Algorithms for computing values and predicates associated with triangles. 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.
Source:

Methods

(static) isInCircleCC(a, b, c, p) → {Boolean}

Computes the inCircle test using distance from the circumcentre. Uses standard double-precision arithmetic.

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)
Parameters:
Name Type Description
a jsts.geom.Coordinate a vertex of the triangle.
b jsts.geom.Coordinate a vertex of the triangle.
c jsts.geom.Coordinate a vertex of the triangle.
p jsts.geom.Coordinate the point to test.
Source:
Returns:
true if this point is inside the circle defined by the points a, b, c.
Type
Boolean

(static) isInCircleDDFast(a, b, c, p) → {Boolean}

Tests if a point is inside the circle defined by the points a, b, c. The computation uses DD arithmetic for robustness.
Parameters:
Name Type Description
a jsts.geom.Coordinate a vertex of the triangle.
b jsts.geom.Coordinate a vertex of the triangle.
c jsts.geom.Coordinate a vertex of the triangle.
p jsts.geom.Coordinate the point to test.
Source:
Returns:
true if this point is inside the circle defined by the points a, b, c.
Type
Boolean

(static) isInCircleDDNormalized(a, b, c, p) → {Boolean}

Tests if a point is inside the circle defined by the points a, b, c. This test uses double-double precision arithmetic.
Parameters:
Name Type Description
a jsts.geom.Coordinate a vertex of the triangle.
b jsts.geom.Coordinate a vertex of the triangle.
c jsts.geom.Coordinate a vertex of the triangle.
p jsts.geom.Coordinate the point to test.
Source:
Returns:
true if this point is inside the circle defined by the points a, b, c.
Type
Boolean

(static) isInCircleDDSlow(a, b, c, p) → {Boolean}

Tests if a point is inside the circle defined by the points a, b, c. The computation uses DD arithmetic for robustness.
Parameters:
Name Type Description
a jsts.geom.Coordinate a vertex of the triangle.
b jsts.geom.Coordinate a vertex of the triangle.
c jsts.geom.Coordinate a vertex of the triangle.
p jsts.geom.Coordinate the point to test.
Source:
Returns:
true if this point is inside the circle defined by the points a, b, c.
Type
Boolean

(static) isInCircleNonRobust(a, b, c, p) → {Boolean}

Tests if a point is inside the circle defined by the points a, b, c. This test uses simple double-precision arithmetic, and thus may not be robust.
Parameters:
Name Type Description
a jsts.geom.Coordinate a vertex of the triangle.
b jsts.geom.Coordinate a vertex of the triangle.
c jsts.geom.Coordinate a vertex of the triangle.
p jsts.geom.Coordinate the point to test.
Source:
Returns:
true if this point is inside the circle defined by the points a, b, c.
Type
Boolean

(static) isInCircleNormalized(a, b, c, p) → {Boolean}

Tests if a point is inside the circle defined by the points a, b, c. This test uses simple double-precision arithmetic, and thus is not 10% robust. However, by using normalization to the origin it provides improved robustness and increased performance.

Based on code by J.R.Shewchuk.

Parameters:
Name Type Description
a jsts.geom.Coordinate a vertex of the triangle.
b jsts.geom.Coordinate a vertex of the triangle.
c jsts.geom.Coordinate a vertex of the triangle.
p jsts.geom.Coordinate the point to test.
Source:
Returns:
true if this point is inside the circle defined by the points a, b, c.
Type
Boolean

(static) isInCircleRobust(a, b, c, p) → {Boolean}

Tests if a point is inside the circle defined by the points a, b, c. This method uses more robust computation.
Parameters:
Name Type Description
a jsts.geom.Coordinate a vertex of the triangle.
b jsts.geom.Coordinate a vertex of the triangle.
c jsts.geom.Coordinate a vertex of the triangle.
p jsts.geom.Coordinate the point to test.
Source:
Returns:
true if this point is inside the circle defined by the points a, b, c.
Type
Boolean

(static) triArea(a, b, c) → {Number}

Computes twice the area of the oriented triangle (a, b, c), i.e. the area is positive if the triangle is oriented counterclockwise.
Parameters:
Name Type Description
a jsts.geom.Coordinate a vertex of the triangle.
b jsts.geom.Coordinate a vertex of the triangle.
c jsts.geom.Coordinate a vertex of the triangle.
Source:
Returns:
The calculated area.
Type
Number

(static) triAreaDDFast(a, b, c) → {jsts.math.DD}

Computes twice the area of the oriented triangle (a, b, c), i.e., the area is positive if the triangle is oriented counterclockwise. The computation uses DD arithmetic for robustness.
Parameters:
Name Type Description
a jsts.geom.Coordinate a vertex in the triangle.
b jsts.geom.Coordinate a vertex in the triangle.
c jsts.geom.Coordinate a vertex in the triangle.
Source:
Returns:
The calculated area.
Type
jsts.math.DD

(static) triAreaDDSlow(ax, ay, bx, by, cx, cy) → {jsts.math.DD}

Computes twice the area of the oriented triangle (a, b, c), i.e., the area is positive if the triangle is oriented counterclockwise. The computation uses DD arithmetic for robustness.
Parameters:
Name Type Description
ax jsts.math.DD the x ordinate of a vertex of the triangle.
ay jsts.math.DD the y ordinate of a vertex of the triangle.
bx jsts.math.DD the x ordinate of a vertex of the triangle.
by jsts.math.DD the y ordinate of a vertex of the triangle.
cx jsts.math.DD the x ordinate of a vertex of the triangle.
cy jsts.math.DD the y ordinate of a vertex of the triangle.
Source:
Returns:
The calculated area.
Type
jsts.math.DD