Class Geometry3DAssertions
- Namespace
- MathAssertions.TUnit
- Assembly
- MathAssertions.TUnit.dll
Fluent assertions over the MathAssertions.Geometry3D primitives: triangle / point-set property predicates, containment, closest-point distance, intersection, and pointcloud aggregates.
public static class Geometry3DAssertions
- Inheritance
-
Geometry3DAssertions
- Inherited Members
Remarks
Distance-from helpers call the static
Distance form rather than the
extension-method form because TUnit's [GenerateAssertion] source generator
inlines expression bodies into a generated assertion class without copying the
using directives that would be needed to resolve the extension call.
Methods
AreCoplanar(Vector3[], double)
Asserts every point in the array lies on a single plane within tolerance.
[GenerateAssertion(ExpectationMessage = "to be coplanar within tolerance {tolerance}", InlineMethodBody = false)]
public static bool AreCoplanar(this Vector3[] value, double tolerance)
Parameters
Returns
ContainsBox(AxisAlignedBox, AxisAlignedBox)
Asserts the outer box contains inner.
[GenerateAssertion(ExpectationMessage = "to contain box {inner}", InlineMethodBody = true)]
public static bool ContainsBox(this AxisAlignedBox value, AxisAlignedBox inner)
Parameters
valueAxisAlignedBoxinnerAxisAlignedBox
Returns
ContainsPoint(AxisAlignedBox, Vector3)
Asserts the AABB contains point.
[GenerateAssertion(ExpectationMessage = "to contain point {point}", InlineMethodBody = true)]
public static bool ContainsPoint(this AxisAlignedBox value, Vector3 point)
Parameters
valueAxisAlignedBoxpointVector3
Returns
ContainsPoint(OrientedBox, Vector3)
Asserts the oriented box contains point.
[GenerateAssertion(ExpectationMessage = "to contain point {point}", InlineMethodBody = true)]
public static bool ContainsPoint(this OrientedBox value, Vector3 point)
Parameters
valueOrientedBoxpointVector3
Returns
ContainsPoint(Sphere, Vector3)
Asserts the sphere contains point.
[GenerateAssertion(ExpectationMessage = "to contain point {point}", InlineMethodBody = true)]
public static bool ContainsPoint(this Sphere value, Vector3 point)
Parameters
Returns
ContainsSphere(AxisAlignedBox, Sphere)
Asserts the box contains sphere entirely.
[GenerateAssertion(ExpectationMessage = "to contain sphere {sphere}", InlineMethodBody = true)]
public static bool ContainsSphere(this AxisAlignedBox value, Sphere sphere)
Parameters
valueAxisAlignedBoxsphereSphere
Returns
ConvexHullContainsPoint(Vector3[], Vector3, double)
Asserts point lies inside the convex hull described by
value's flat triples-of-three vertex layout.
[GenerateAssertion(ExpectationMessage = "to contain point {point} within tolerance {tolerance}", InlineMethodBody = false)]
public static bool ConvexHullContainsPoint(this Vector3[] value, Vector3 point, double tolerance)
Parameters
Returns
HasCentroidAt(Vector3[], Vector3, double)
Asserts the cloud's centroid is approximately expected.
[GenerateAssertion(ExpectationMessage = "to have centroid approximately {expected} within tolerance {tolerance}", InlineMethodBody = false)]
public static bool HasCentroidAt(this Vector3[] value, Vector3 expected, double tolerance)
Parameters
Returns
HasDistanceFromPlane(Vector3, Plane, double, double)
Asserts the perpendicular distance from value to
plane is approximately expected.
[GenerateAssertion(ExpectationMessage = "to be at distance {expected} from {plane} within tolerance {tolerance}", InlineMethodBody = true)]
public static bool HasDistanceFromPlane(this Vector3 value, Plane plane, double expected, double tolerance)
Parameters
Returns
HasDistanceFromSegment(Vector3, LineSegment3D, double, double)
Asserts the closest-point distance from value to
segment is approximately expected.
[GenerateAssertion(ExpectationMessage = "to be at distance {expected} from {segment} within tolerance {tolerance}", InlineMethodBody = true)]
public static bool HasDistanceFromSegment(this Vector3 value, LineSegment3D segment, double expected, double tolerance)
Parameters
valueVector3segmentLineSegment3Dexpecteddoubletolerancedouble
Returns
HasDistanceFromTriangle(Vector3, Triangle3D, double, double)
Asserts the closest-point distance from value to
triangle is approximately expected.
[GenerateAssertion(ExpectationMessage = "to be at distance {expected} from {triangle} within tolerance {tolerance}", InlineMethodBody = true)]
public static bool HasDistanceFromTriangle(this Vector3 value, Triangle3D triangle, double expected, double tolerance)
Parameters
valueVector3triangleTriangle3Dexpecteddoubletolerancedouble
Returns
IntersectsBox(AxisAlignedBox, AxisAlignedBox)
Asserts two boxes intersect (boundary contact counts).
[GenerateAssertion(ExpectationMessage = "to intersect box {other}", InlineMethodBody = true)]
public static bool IntersectsBox(this AxisAlignedBox value, AxisAlignedBox other)
Parameters
valueAxisAlignedBoxotherAxisAlignedBox
Returns
IntersectsBox(Ray3D, AxisAlignedBox)
Asserts the ray hits box.
[GenerateAssertion(ExpectationMessage = "to intersect box {box}", InlineMethodBody = true)]
public static bool IntersectsBox(this Ray3D value, AxisAlignedBox box)
Parameters
valueRay3DboxAxisAlignedBox
Returns
IntersectsPlane(Ray3D, Plane)
Asserts the ray hits plane in front of its origin.
[GenerateAssertion(ExpectationMessage = "to intersect plane {plane}", InlineMethodBody = true)]
public static bool IntersectsPlane(this Ray3D value, Plane plane)
Parameters
Returns
IntersectsSphere(Ray3D, Sphere)
Asserts the ray hits sphere.
[GenerateAssertion(ExpectationMessage = "to intersect sphere {sphere}", InlineMethodBody = true)]
public static bool IntersectsSphere(this Ray3D value, Sphere sphere)
Parameters
Returns
IntersectsSphere(Sphere, Sphere)
Asserts two spheres intersect (boundary contact counts).
[GenerateAssertion(ExpectationMessage = "to intersect sphere {other}", InlineMethodBody = true)]
public static bool IntersectsSphere(this Sphere value, Sphere other)
Parameters
Returns
IntersectsTriangle(Ray3D, Triangle3D)
Asserts the ray hits triangle.
[GenerateAssertion(ExpectationMessage = "to intersect triangle {triangle}", InlineMethodBody = true)]
public static bool IntersectsTriangle(this Ray3D value, Triangle3D triangle)
Parameters
valueRay3DtriangleTriangle3D
Returns
IsApproximatelyOnPlane(Vector3[], Plane, double)
Asserts every point in the cloud lies within maxResidual of plane.
[GenerateAssertion(ExpectationMessage = "to lie approximately on plane {plane} within residual {maxResidual}", InlineMethodBody = false)]
public static bool IsApproximatelyOnPlane(this Vector3[] value, Plane plane, double maxResidual)
Parameters
Returns
IsApproximatelyOnSphere(Vector3[], Vector3, float, double)
Asserts every point in the cloud lies within maxResidual of the sphere surface.
[GenerateAssertion(ExpectationMessage = "to lie approximately on a sphere centered at {center} with radius {radius} within residual {maxResidual}", InlineMethodBody = false)]
public static bool IsApproximatelyOnSphere(this Vector3[] value, Vector3 center, float radius, double maxResidual)
Parameters
Returns
IsBoundedByBox(Vector3[], AxisAlignedBox)
Asserts every point in the cloud lies inside box.
[GenerateAssertion(ExpectationMessage = "to be bounded by box {box}", InlineMethodBody = false)]
public static bool IsBoundedByBox(this Vector3[] value, AxisAlignedBox box)
Parameters
valueVector3[]boxAxisAlignedBox
Returns
IsBoundedBySphere(Vector3[], Sphere)
Asserts every point in the cloud lies inside sphere.
[GenerateAssertion(ExpectationMessage = "to be bounded by sphere {sphere}", InlineMethodBody = false)]
public static bool IsBoundedBySphere(this Vector3[] value, Sphere sphere)
Parameters
Returns
IsCollinear(Vector3[], double)
Asserts every point in the array is collinear within tolerance.
[GenerateAssertion(ExpectationMessage = "to be collinear within tolerance {tolerance}", InlineMethodBody = false)]
public static bool IsCollinear(this Vector3[] value, double tolerance)
Parameters
Returns
IsDegenerate(Triangle3D, double)
Asserts the triangle's area is at most tolerance.
[GenerateAssertion(ExpectationMessage = "to be a degenerate triangle within tolerance {tolerance}", InlineMethodBody = true)]
public static bool IsDegenerate(this Triangle3D value, double tolerance)
Parameters
valueTriangle3Dtolerancedouble