Overlap testing

Back to Shape relations

Two shapes overlap if their intersection is non-empty.

Practice

Testing for overlap is an easier problem than finding and describing the intersection-shape. Pastel implements several overlap tests between pairs of shapes. They are listed in the following table.

Shape/Shape Point AlignedBox Box Sphere Plane Segment Capsule Triangle Simplex
Point -
AlignedBox nD nD
Box nD nD nD
Sphere nD nD nD nD
Plane - nD nD nD +
Segment - + + + + -
Capsule + + + + + + +
Triangle - 2D, 3D 2D, 3D nD nD + + 1D, 2D, 3D
Simplex nD + + + + + + + +

where

See also

Shapes

Intersection between shapes

Learn more

Files

Intersection in a line segment set

Overlap tests between a 2-flat and a plane

Overlap tests between a box and a point

Overlap tests between a box and a sphere

Overlap tests between a box and a triangle

Overlap tests between a plane and a box

Overlap tests between a plane and a sphere

Overlap tests between a plane and a triangle

Overlap tests between a sphere and a point

Overlap tests between an aligned box and a box

Overlap tests between an aligned box and a point

Overlap tests between an aligned box and a sphere

Overlap tests between an aligned box and a triangle

Overlap tests between an aligned plane an a box

Overlap tests between an aligned plane an a triangle

Overlap tests between an aligned plane and a sphere

Overlap tests between an aligned plane and an aligned box

Overlap tests between two aligned boxes

Overlap tests between two boxes

Overlap tests between two capsules

Overlap tests between two line segments

Overlap tests between two spheres

Overlap tests between two triangles

Testing for alignedbox-alignedbox overlap