Class Properties
- Namespace
- MathAssertions.Geometry3D
- Assembly
- MathAssertions.dll
Geometric-property predicates over MathAssertions.Geometry3D primitives and point sets: triangle degeneracy, point-set collinearity, and point-set coplanarity.
public static class Properties
- Inheritance
-
Properties
- Inherited Members
Methods
AreCoplanar(ReadOnlySpan<Vector3>, double)
Returns true when every point in points lies
on a single plane within tolerance. Sequences with fewer than
four points are vacuously coplanar; sequences in which every point is collinear
are also coplanar (every line lies on infinitely many planes).
public static bool AreCoplanar(ReadOnlySpan<Vector3> points, double tolerance)
Parameters
pointsReadOnlySpan<Vector3>Points to test.
tolerancedoubleMaximum allowed perpendicular displacement from the plane. Must be non-negative and not NaN.
Returns
Remarks
Searches the input for a non-collinear triple and uses it to construct the test
plane. If no such triple exists the entire set is collinear, which trivially
satisfies coplanarity. The search is at worst quadratic in the number of points
when most pairs are collinear with points[0]; for typical test inputs the
non-collinear triple is found in the first few iterations.
Exceptions
- ArgumentOutOfRangeException
toleranceis NaN or negative.
IsCollinear(ReadOnlySpan<Vector3>, double)
Returns true when every point in points lies
on a single line within tolerance. Sequences with fewer than
three points are vacuously collinear; sequences in which all points coincide are
also collinear.
public static bool IsCollinear(ReadOnlySpan<Vector3> points, double tolerance)
Parameters
pointsReadOnlySpan<Vector3>Points to test.
tolerancedoubleMaximum allowed perpendicular displacement from the line. Must be non-negative and not NaN.
Returns
Remarks
Picks the first non-trivial direction in the sequence (the first point distinct
from points[0] within tolerance) and tests perpendicular distance from
that direction for every point. Handling the leading-coincident-points case
explicitly avoids the false-true result a naive implementation that locks in
points[1] - points[0] would produce when those first two points coincide.
The perpendicular-distance check is computed as
|direction × (p - p0)| / |direction|: the cross-product magnitude alone is
scaled by |direction|, so comparing it directly to a length-dimensioned
tolerance would let a longer baseline silently widen the apparent tolerance.
Dividing by the direction magnitude restores the dimensionally correct
perpendicular distance from the point to the line through p0.
Exceptions
- ArgumentOutOfRangeException
toleranceis NaN or negative.
IsDegenerate(Triangle3D, double)
Returns true when the triangle's area is at most
tolerance, indicating collinear or coincident vertices.
public static bool IsDegenerate(this Triangle3D t, double tolerance)
Parameters
tTriangle3DTriangle to test.
tolerancedoubleMaximum area considered degenerate. Must be non-negative and not NaN.
Returns
Exceptions
- ArgumentOutOfRangeException
toleranceis NaN or negative.