Back to class index
| Polyhedron::ClipLineSegmentToConvexPolyhedronSyntaxbool 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 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. Parametersconst 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 ValueTrue 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 |