PolyhedronImpl

Engine/source/math/mPolyhedron.h

A polyhedron.

More...

Transform

transform(const MatrixF & matrix, const Point3F & scale)

Transform the polyhedron using the given transform matrix and scale.

Containment

bool
isContained(const Point3F & point, F32 epsilon)
bool
isContained(const Point3F * points, U32 numPoints)
bool
bool

Intersection

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

For precise testing, use Intersector.

Clipping

Functionality to clip other geometries against the polyhedron.

bool
clipSegment(Point3F & pnt0, Point3F & pnt1)
clipPolygon(const Point3F * inVertices, U32 inNumVertices, Point3F * outVertices, U32 maxOutVertices)

Construction

Operations for constructing solids and polygons through boolean operations involving the polyhedron.

constructIntersection(const PlaneF & plane, Point3F * outPoints, U32 maxOutPoints)

Build the intersection of this polyhedron with the given plane.

Extraction

extractFace(U32 plane, IndexType * outIndices, U32 maxOutIndices)

Extract the polygon for the given plane.

Public Types

Base::Edge
Edge 
Base::EdgeListType
EdgeListType 
Base::PlaneListType
PlaneListType 
Base::PointListType
PointListType 

Public Functions

Construct an empty polyhedron.

Construct a polyhedron described by the given planes and edges.

Return the AABB around the polyhedron.

Return the median point of all points defined on the polyhedron.

Protected Functions

Detailed Description

A polyhedron.

Polyhedrons are stored as both sets of planes as well sets of edges and vertices (basically a winged-edge format).

Polyhedrons must be convex.

note:

The default orientation for the plane normals of a polyhedron is inwards.

Transform

transform(const MatrixF & matrix, const Point3F & scale)

Transform the polyhedron using the given transform matrix and scale.

Containment

isContained(const Point3F & point, F32 epsilon)

see:

PlaneSet::isContained(const Point3F&,F32)

isContained(const Point3F * points, U32 numPoints)

see:

PlaneSet::isContained(const Point3F*,U32)

isContained(const Box3F & aabb)

see:

PlaneSet::isContained(const Box3F&)

isContained(const SphereF & sphere)

see:

PlaneSet::isContained(const SphereF&)

isContained(const OrientedBox3F & obb)

see:

PlaneSet::isContained(const OrientedBox3F&)

Intersection

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

For precise testing, use Intersector.

testPotentialIntersection(const Box3F & aabb)

see:

PlaneSet::testPotentialIntersection(const Box3F&)

testPotentialIntersection(const SphereF & sphere)

see:

PlaneSet::testPotentialIntersection(const SphereF&)

testPotentialIntersection(const OrientedBox3F & obb)

see:

PlaneSet::testPotentialIntersection(const OrientedBox3F&)

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

Clipping

Functionality to clip other geometries against the polyhedron.

clipSegment(Point3F & pnt0, Point3F & pnt1)

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

Construction

Operations for constructing solids and polygons through boolean operations involving the polyhedron.

constructIntersection(const PlaneF & plane, Point3F * outPoints, U32 maxOutPoints)

Build the intersection of this polyhedron with the given plane.

The result is a polygon.

Parameters:

plane

Plane to intersect the polyhedron with.

outPoints

(out) Array where the resulting polygon points are stored. A safe size is to just allocate as many points as there are edges in the polyhedron. If you know the maximum number of vertices that can result from the intersection (for example, 4 for a box), then it is ok to only allocate that much.

maxOutPoints

Number of points that can be stored in outPoints. If insufficient, the return value will be 0.

return:

The number of points written to outPoints. If there is no intersection between the given plane and the polyhedron, this will be zero.

note:

The resulting points will be ordered to form a proper polygon but there is no guarantee on which direction the ordering is in compared to the plane.

Extraction

extractFace(U32 plane, IndexType * outIndices, U32 maxOutIndices)

Extract the polygon for the given plane.

The resulting indices will be CW ordered if the plane normals on the polyhedron are facing inwards and CCW ordered otherwise.

Parameters:

plane

Index of the plane on the polyhedron.

outIndices

Array where the resulting vertex indices will be stored. Must have enough room. If you don't know the exact size that you need, just allocate one index for any point in the mesh.

maxOutIndices

The number of indices that can be stored in outIndices. If insufficient, the return value will be 0.

return:

Number of indices written to outIndices.

note:

This method relies on correct CW ordering of edges with respect to face[0].

Public Types

typedef Base::Edge Edge 
typedef Base::EdgeListType EdgeListType 
typedef Base::PlaneListType PlaneListType 
typedef Base::PointListType PointListType 

Public Functions

PolyhedronImpl()

Construct an empty polyhedron.

PolyhedronImpl(PlaneListType planes, PointListType points, EdgeListType edges)

Construct a polyhedron described by the given planes and edges.

getBounds()

Return the AABB around the polyhedron.

getCenterPoint()

Return the median point of all points defined on the polyhedron.

Protected Functions

_testOverlap(const P & bounds)