Back to class index
Polyhedron[Class Summary]
v
f
ctor
NumVertices()[const]
NumFaces()[const]
NumEdges()[const]
VertexArrayPtr() (+1 overload)
Vertex(vertexIndex)[const]
Edge(edgeIndex)[const]
Edges()[const]
Faces()[const]
EdgeIndices()[const]
FacePolygon(faceIndex)[const]
FacePlane(faceIndex)[const]
FaceNormal(faceIndex)[const]
ExtremeVertex(direction)[const]
ExtremePoint(direction)[const]
ProjectToAxis(...)[const]
ConvexCentroid()[const]
ApproximateConvexCentroid()[const]
SurfaceArea()[const]
Volume()[const]
MinimalEnclosingAABB()[const]
MergeAdjacentPlanarFaces()
FaceIndicesValid()[const]
FlipWindingOrder()
OrientNormalsOutsideConvex()
RemoveRedundantVertices()
IsNull()[const]
IsClosed()[const]
IsConvex()[const]
EulerFormulaHolds()[const]
FacesAreNondegeneratePlanar(epsilon)[const]
ClipLineSegmentToConvexPolyhedron(...)[const]
NearestVertex(point)[const]
Contains(point)[const] (+7 overloads)
FaceContains(...)[const]
FaceContainmentDistance2D(...)[const]
ContainsConvex(point,epsilon)[const] (+2 overloads)
ClosestPoint(...)[const] (+2 overloads)
ClosestPointConvex(point)[const]
Distance(point)[const]
Intersects(lineSegment)[const] (+11 overloads)
IntersectsConvex(line)[const] (+2 overloads)
MergeConvex(point)
Translate(offset)
Transform(transform) (+3 overloads)
SetEquals(p2)
SwapVertices(i,j)
CanonicalizeFaceArray()
ContainsFace(face)[const]
FindClosestVertex(pt,outDistanceSq)[const]
Triangulate()[const]
ToString()[const]
ConvexHull(...)[static]
Tetrahedron(...)[static]
Octahedron(...)[static]
Hexahedron(...)[static]
Icosahedron(...)[static]
Dodecahedron(...)[static]

Polyhedron::Intersects

Syntax

bool Polyhedron::Intersects(const LineSegment &lineSegment) const; [16 lines of code]
bool Polyhedron::Intersects(const Line &line) const; [8 lines of code]
bool Polyhedron::Intersects(const Ray &ray) const; [8 lines of code]
bool Polyhedron::Intersects(const Plane &plane) const; [4 lines of code]
bool Polyhedron::Intersects(const Polyhedron &polyhedron) const; [52 lines of code]
bool Polyhedron::Intersects(const AABB &aabb) const; [4 lines of code]
bool Polyhedron::Intersects(const OBB &obb) const; [4 lines of code]
bool Polyhedron::Intersects(const Triangle &triangle) const; [4 lines of code]
bool Polyhedron::Intersects(const Polygon &polygon) const; [4 lines of code]
bool Polyhedron::Intersects(const Frustum &frustum) const; [4 lines of code]
bool Polyhedron::Intersects(const Sphere &sphere) const; [5 lines of code]
bool Polyhedron::Intersects(const Capsule &capsule) const; [6 lines of code]

Tests whether this polyhedron and the given object intersect.

Both objects are treated as "solid", meaning that if one of the objects is fully contained inside another, this function still returns true. (e.g. in case a line segment is contained inside this polyhedron, or this polyhedron is contained inside a sphere, etc.)

Note
This function assumes that this polyhedron is closed and the edges are not self-intersecting.

The algorithm for Polyhedron-Polyhedron intersection is from Christer Ericson's Real-Time Collision Detection, p.

384. As noted by the author, the algorithm is very naive (and here unoptimized), and better methods exist.

Return Value

True if an intersection occurs or one of the objects is contained inside the other, false otherwise.

See Also

Contains(), ContainsConvex(), ClosestPoint(), ClosestPointConvex(), Distance(), IntersectsConvex().

Work in progress:

Todo: in bool Polyhedron::Intersects(const LineSegment &lineSegment) const:
Add Intersects(Circle/Disc).