# PlaneSet

Engine/source/math/mPlaneSet.h

Set of planes which can be tested against bounding volumes.

## Constructors

## Accessors

Return the number of planes that this set consists of.

## Intersection

All of these intersection methods are approximate in that they can produce false positives on GeometryIntersecting.

For precise results, use Intersector.

testPotentialIntersection(const Box3F & aabb)

Test intersection of the given AABB with the volume defined by the plane set.

testPotentialIntersection(const SphereF & sphere)

Test intersection of the given sphere with the volume defined by the plane set.

Test intersection of the given OBB with the volume defined by the plane set.

## Containment

Testing for containment of geometric shapes within the volume enclosed by the planes.

```
bool
```

isContained(const Point3F & point, F32 epsilon)

Return true if the given point lies on the positive side of all the planes in the set.

```
bool
```

isContained(const Point3F * points, U32 numPoints)

Return true if all of the given points lie on the positive side of all the planes in the set.

```
bool
```

isContained(const Box3F & aabb)

Return true if the given AABB lies on the positive side of all the planes in the set.

```
bool
```

isContained(const SphereF & sphere)

Return true if the given sphere lies on the positive side of all the planes in the set.

```
bool
```

isContained(const OrientedBox3F & obb)

Return true if the given OBB lies on the positive side of all the planes in the set.

## Clipping

```
bool
```

clipSegment(Point3F & pnt0, Point3F & pnt1)

Clip the given line segment against the plane set.

## Protected Functions

```
bool
```

_isContained(const P & bounds)

_testOverlap(const P & bounds)

## Detailed Description

Set of planes which can be tested against bounding volumes.

This class is meant as a helper to collect functionality for working with sets of planes. As a helper, it does not define means to manage the data it uses.

@warn This class does not manage the memory needed for the set.

## Constructors

PlaneSet()

Create an uninitialized set.

@warn None of the members will be initialized.

PlaneSet(const T * planes, U32 numPlanes)

Use the given set of planes to initialize the set.

**Parameters:**

planes | The planes. Memory must be valid for the entire lifetime of the plane set. |

numPlanes | Number of planes. |

## Accessors

getNumPlanes()

Return the number of planes that this set consists of.

getPlanes()

Return the array of planes for this set.

## Intersection

All of these intersection methods are approximate in that they can produce false positives on GeometryIntersecting.

For precise results, use Intersector.

testPotentialIntersection(const Box3F & aabb)

Test intersection of the given AABB with the volume defined by the plane set.

**Parameters:**

aabb | Axis-aligned bounding box. |

The type of overlap that the given AABB has with the plane set.

note:The method will not test for those edge cases where none of the planes rejects the given AABB yet the AABB is actually outside the volume defined by the planes. This speeds up the test at the cost of losing precision which is acceptable for cases where doing the additional tests for all intersecting objects will generally waste more time than accepting a few additional non-intersecting objects as intersecting.

testPotentialIntersection(const SphereF & sphere)

Test intersection of the given sphere with the volume defined by the plane set.

**Parameters:**

sphere | Sphere. |

The type of overlap that the given sphere has with the plane set.

note:The method will not test for those edge cases where none of the planes rejects the given sphere yet the sphere is actually outside the volume defined by the planes. This speeds up the test at the cost of losing precision which is acceptable for cases where doing the additional tests for all intersecting objects will generally waste more time than accepting a few additional non-intersecting objects as intersecting.

testPotentialIntersection(const OrientedBox3F & obb)

Test intersection of the given OBB with the volume defined by the plane set.

**Parameters:**

obb | Oriented bounding box. |

The type of overlap that the given OBB has with the plane set.

note:The method will not test for those edge cases where none of the planes rejects the given OBB yet the OBB is actually outside the volume defined by the planes. This speeds up the test at the cost of losing precision which is acceptable for cases where doing the additional tests for all intersecting objects will generally waste more time than accepting a few additional non-intersecting objects as intersecting.

testPlanes(const Box3F & bounds, U32 planeMask, F32 expand)

Returns a bitmask of which planes are hit by the given box.

## Containment

Testing for containment of geometric shapes within the volume enclosed by the planes.

isContained(const Point3F & point, F32 epsilon)

Return true if the given point lies on the positive side of all the planes in the set.

isContained(const Point3F * points, U32 numPoints)

Return true if all of the given points lie on the positive side of all the planes in the set.

isContained(const Box3F & aabb)

Return true if the given AABB lies on the positive side of all the planes in the set.

isContained(const SphereF & sphere)

Return true if the given sphere lies on the positive side of all the planes in the set.

isContained(const OrientedBox3F & obb)

Return true if the given OBB lies on the positive side of all the planes in the set.

## Clipping

clipSegment(Point3F & pnt0, Point3F & pnt1)

Clip the given line segment against the plane set.

If the segment intersects with any of the planes, the points will be clipped at the intersection.

True if any part of the segment is inside the volume defined by the plane set.

clipPolygon(const Point3F * inVertices, U32 inNumVertices, Point3F * outVertices, U32 maxOutVertices)

Clip a convex polygon by all planes in the set.

**Parameters:**

inVertices | Array holding the vertices of the input polygon. |

inNumVertices | Number of vertices in |

outVertices | Array to hold the vertices of the clipped polygon. Must have spaces for |

maxOutVertices | Maximum number of vertices that can be stored in |

Number of vertices in the clipped polygon, i.e. number of vertices stored in *outVertices*.

note:Be aware that if the polygon fully lies on the negative side of all planes, the resulting

outNumVerticeswill be zero, i.e. no polygon will result from the clip.