A 2d floating point arithmetic point-in-triangle predicate.

Namespace:  ceometric.ComputationalGeometry
Assembly:  ceometric.ComputationalGeometry (in ceometric.ComputationalGeometry.dll) Version: 2.4.0.0 (2.4.0.0)

Syntax

C#
public static double InTriangleArbitrary(
	Point vertex1,
	Point vertex2,
	Point vertex3,
	Point point
)
Visual Basic (Declaration)
Public Shared Function InTriangleArbitrary ( _
	vertex1 As Point, _
	vertex2 As Point, _
	vertex3 As Point, _
	point As Point _
) As Double
Visual C++
public:
static double InTriangleArbitrary(
	Point^ vertex1, 
	Point^ vertex2, 
	Point^ vertex3, 
	Point^ point
)

Parameters

vertex1
Type: ceometric.VectorGeometry..::.Point
A vertex of a 2d triangle.
vertex2
Type: ceometric.VectorGeometry..::.Point
A vertex of a 2d triangle.
vertex3
Type: ceometric.VectorGeometry..::.Point
A vertex of a 2d triangle.
point
Type: ceometric.VectorGeometry..::.Point
A 2d point.

Return Value

For a clockwise OR counterclockwise arrangement of the vertices, the predicate is
  • positive if point lies inside the triangle.
  • zero if point lies on the circumference of the triangle.
  • negative if point lies outside the triangle.

Remarks

Due to floating point arithmetic, this predicate is not is not reliable for near-degenerate cases.

See Also