Class Intersection
- Namespace
- MathAssertions.Geometry3D
- Assembly
- MathAssertions.dll
Boolean intersection predicates and parametric ray-intersection results for the
MathAssertions.Geometry3D primitives plus Plane. Each ray-intersection
pair offers both a boolean overload (for tests that only care whether the ray hits)
and a parametric overload that exposes the hit-distance t along the ray.
public static class Intersection
- Inheritance
-
Intersection
- Inherited Members
Methods
Intersects(AxisAlignedBox, AxisAlignedBox)
Returns true when two axis-aligned boxes overlap on every axis (boundary contact counts as intersection).
public static bool Intersects(AxisAlignedBox a, AxisAlignedBox b)
Parameters
Returns
Intersects(Ray3D, AxisAlignedBox)
Returns true when ray intersects
box. Slab-test implementation.
public static bool Intersects(Ray3D ray, AxisAlignedBox box)
Parameters
rayRay3DboxAxisAlignedBox
Returns
Remarks
Reference: Akenine-Möller, Haines, Hoffman, Real-Time Rendering 4th ed., §22.7.
Intersects(Ray3D, Sphere)
Returns true when ray intersects the closed
solid sphere. Geometric solution: project the sphere center
onto the ray, then compare squared perpendicular distance to squared radius.
public static bool Intersects(Ray3D ray, Sphere sphere)
Parameters
Returns
Remarks
Reference: Akenine-Möller, Haines, Hoffman, Real-Time Rendering 4th ed., §22.6.
Intersects(Ray3D, Triangle3D)
Boolean shorthand for the Intersects(Ray3D, Triangle3D, out float) overload.
public static bool Intersects(Ray3D ray, Triangle3D triangle)
Parameters
rayRay3DtriangleTriangle3D
Returns
Intersects(Ray3D, Triangle3D, out float)
Returns true when ray hits
triangle at a non-negative distance along the ray, and
outputs the hit-distance parameter t. Implemented via the
Möller-Trumbore algorithm. A ray parallel to the triangle plane returns
false with t == 0.
public static bool Intersects(Ray3D ray, Triangle3D triangle, out float t)
Parameters
rayRay3DtriangleTriangle3Dtfloat
Returns
Remarks
Reference: Akenine-Möller, Haines, Hoffman, Real-Time Rendering 4th ed., §22.8.
Intersects(Ray3D, Plane)
Boolean shorthand for the Intersects(Ray3D, Plane, out float) overload.
public static bool Intersects(Ray3D ray, Plane plane)
Parameters
Returns
Intersects(Ray3D, Plane, out float)
Returns true when ray hits
plane at a non-negative distance along the ray, and outputs
the hit-distance parameter t. A ray parallel to the plane
returns false with t == 0.
public static bool Intersects(Ray3D ray, Plane plane, out float t)
Parameters
rayRay3DRay to test.
planePlanePlane to test against.
tfloatHit-distance along
rayon success;0when the method returns false.
Returns
Intersects(Sphere, Sphere)
Returns true when the closed solid spheres
a and b overlap (boundary contact counts as
intersection). Compared via squared center distance to avoid the square root.
public static bool Intersects(Sphere a, Sphere b)