Table of Contents

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

a AxisAlignedBox
b AxisAlignedBox

Returns

bool

Intersects(Ray3D, AxisAlignedBox)

Returns true when ray intersects box. Slab-test implementation.

public static bool Intersects(Ray3D ray, AxisAlignedBox box)

Parameters

ray Ray3D
box AxisAlignedBox

Returns

bool

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

ray Ray3D
sphere Sphere

Returns

bool

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

ray Ray3D
triangle Triangle3D

Returns

bool

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

ray Ray3D
triangle Triangle3D
t float

Returns

bool

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

ray Ray3D
plane Plane

Returns

bool

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

ray Ray3D

Ray to test.

plane Plane

Plane to test against.

t float

Hit-distance along ray on success; 0 when the method returns false.

Returns

bool

true if the ray crosses the plane in front of its origin.

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)

Parameters

a Sphere
b Sphere

Returns

bool