It is required to compute the intersection point to perform this test. Here, we: (1) compute the intersection, (2) compute squares of distances from the point of intersection to the surface endpoints, and (3) test these versus the square of the length of the surface.
The intersection point lies outside the surface, and the intersection is invalidated if and only if:
where i = 1 or 2. Recall that has been precomputed and stored during the input phase. Note that, it is neither necessary nor desirable to take the square root in equation (8). First, this is an unnecessary operation. Secondly, taking the square root reduces by a factor of two any small difference in the quantities and ,
thereby exacerbating errors which might occur due to insufficient precision.