Graphics Reference
In-Depth Information
segList function CSG_RayIntersect ( CSGtree T, ray r)
begin
segList LL, RL;
if IsPrimitive (T)
then return RayIntersection (T, r)
{RayIntersection computes the intersection of the ray with a primitive
object directly on a case by case basis using its special properties.}
else
begin
LL := CSG_RayIntersect (LeftSubtree (T), r);
if (Empty (LL) and (Op (T) π»))
then return nil
else
begin
RL := CSG_RayIntersect (RightSubtree (T), r);
return CombineSegs (LL, RL, Op (T));
end
end
end ;
Algorithm 10.2.3.1.
CSG ray intersection algorithm.
Left
Right
»
«
-
in
in
in
in
out
in
out
in
out
in
out
in
in
out
out
out
out
out
out
out
Finally, if all one wants is to determine whether or not a ray intersects an object
and one is not interested in the actual intersection, then one can use a simplified
version of Algorithm 10.2.3.1. There is no need to check for an intersection of the
right subtree if one determines that the left subtree was intersected.
To speed things up one should use bounding boxes at each node of the CSG tree.
Bounding boxes work best when they are lined up with the viewing coordinate system.
Maintaining this would mean that one has to recompute them whenever the view
changes. If this happens a lot, one could use bounding spheres, but boxes typically fit
objects better than spheres.
10.3
The Radiosity Method
As indicated in Section 9.4.4, radiosity methods were another step to model illumi-
nation more accurately. They correct some defects in the ray-tracing approach. In par-
Search WWH ::




Custom Search