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::ClipLineSegmentToConvexPolyhedron

Syntax

bool Polyhedron::ClipLineSegmentToConvexPolyhedron(const float4 &ptA, const float4 &dir, float &tFirst, float &tLast) const; [44 lines of code]

Clips the line/ray/line segment specified by L(t) = ptA + t * dir, tFirst <= t <= tLast, inside this convex polyhedron.

The implementation of this function is adapted from Christer Ericson's Real-time Collision Detection, p. 199.

Note
To clip a line, pass in tFirst=-FLOAT_INF, tLast=FLOAT_INF. To clip a ray, pass in tFirst=0 and tLast = FLOAT_INF. To clip a line segment, pass in tFirst=0, tLast=1, and an unnormalized dir = lineSegment.b-lineSegment.a.

Parameters

const float4 &ptAThe first endpoint of the line segment. const float4 &dirThe direction of the line segment. This member can be unnormalized. float &tFirst [in, out]As input, takes the parametric distance along the line segment which specifies the starting point of the line segment. As output, the starting point of the line segment after the clipping operation is returned here.float &tLast [in, out]As input, takes the parametric distance along the line segment which specifies the ending point of the line segment. As output, the endingpoint of the line segment after the clipping operation is returned here.

Return Value

True if the outputted range [tFirst, tLast] did not become degenerate, and these two variables contain valid data. If false, the whole line segment was clipped away (it was completely outside this polyhedron).

See Also

FLOAT_INF.