# PolyhedronBoxIntersector

Engine/source/math/mIntersector.h

Convex polyhedron / AABB intersection.

## Public Types

```
Parent
```

```
PolyhedronType
```

## Protected Attributes

## Protected Functions

_preprocess(const MatrixF & objToWorld, const Point3F & scale)

Run the preprocessing step on the current polyhedron.

## Public Functions

PolyhedronBoxIntersector(const PolyhedronType & polyhedron, const MatrixF & objToWorld, const Point3F & scale, const Box3F & wsBounds)

## Detailed Description

Convex polyhedron / AABB intersection.

This class implements the algorithm described in "Detecting Intersection of a Rectangular Solid and a Convex Polyhedron", Graphics Gems IV, Chapter 1.7, by Ned Greene.

The polyhedron is preprocessed when an object of this class is constructed.

This class also assumes that the polyhedron is represented in object space and thus also stores local copies of the polyhedron's planes transformed into world space.

The approach of the algorithm is simple. It uses a maximum of three successive stages to determine intersection. Each stage can early out if it can draw a conclusive result already.

Simple tests of the polyhedron's bounding box against the input box.

Standard test on plane set.

Plane tests reduced to 2D and done for each of the orthographic side projections.

note:The intersector depends on planes facing inwards.

## Public Types

typedef IntersectorBase< Polyhedron, Box3F > Parent

typedef Polyhedron PolyhedronType

## Protected Attributes

Box3F mBounds

Bounds of the polyhedron.

Vector< Point3F > mEdgeLines

Edge line equations.

X projection first, then Y, then Z. X of each equation is mapped to a, Y to b, and Z to c of the standard implicit form of line equations.

Point3I mNumEdgeLines

Number of silhouette edges for each of the orthographic projections.

Vector< PlaneF > mPlanes

World-space planes.

## Protected Functions

_preprocess(const MatrixF & objToWorld, const Point3F & scale)

Run the preprocessing step on the current polyhedron.

_project(U32 axis, const Point3F & p)

Project the point orthogonally down the given axis such that the orientation of the resulting coordinate system remains right-handed.

## Public Functions

PolyhedronBoxIntersector()

PolyhedronBoxIntersector(const PolyhedronType & polyhedron, const MatrixF & objToWorld, const Point3F & scale, const Box3F & wsBounds)

test(const Box3F & box)