11.7 Planar Components and Quadric Surfaces 563
line1.direction = cylinder.axis;
line2.base = bPrime+e*offset;
line2.direction = cylinder.axis;
return true;
}
// cosTheta != 0, so intersection is circle or ellipse
if (abs(cosTheta) == 1) {
// Circle
Circle circle;
circle.center = bPrime;
circle.normal = cylinder.axis;
circle.radius = cylinder.radius;
return true;
}
// abs(cosTheta) != 0 and abs(cosTheta) != 1, so ellipse
Ellipse ellipse;
ellipse.center = bPrime - (d / cosTheta) * cylinder.axis;
ellipse.u = cylinder.axis - cosTheta * plane.normal;
ellipse.v = Cross(plane.normal, ellipse.u);
rU = cylinder.radius / abs(cosTheta);
rV = cylinder.radius;
return true;
}
11.7.4 Plane and Cone
In this section we address the problem of the intersection of a plane and a cone, as
shown in Figure 11.42. There are actually quite a number of ways a cone and a plane
can intersect, eight of which are shown in Figure 11.43. Note that the intersections
are shown for a finite cone; an infinite cone has fewer intersection configurations
because we don’t need to deal with the end caps. We give algorithms for intersection
detection of a plane and an infinite cone and for a plane and a finite cone; the former
is somewhat simpler. In a later section, we’ll give an algorithm for computing the
intersection of a plane and an infinite cone. These algorithms can be extended to a
finite cone by “clipping” the extent of the conic intersection curve or lines by the
planes containing the end caps.