Java Reference
In-Depth Information
This is because the pickTool used is a PickSegment of length 4 extending from the eye
position into the virtual universe, and this will not intersect the objects in the third row,
which are at a distance of more than four from the eye position.
cone pIckInG shape
PickConeRay and PickConeSegment belong to the abstract base class of PickCone. The
main difference between the picking shapes under PickCone and PickRay, which have
been discussed in previous sections, is that the former is conic in shape while the latter is
a ray or a line with theoretically zero width or thickness. Obviously, picking visual objects
using a conic type of shape will be advantageous if the object has a cross section or size
that is too small to be picked or intersected by a line.
To illustrate the use of PickConeRay, which has a picking shape that corresponds to a
cone with infinite length, we will now outline an example consisting of 3 spheres, a big-
ger sphere at the origin, and two smaller ones at other locations. Point light sources are
also placed at the same positions as the two smaller spheres so that they are emitting light
effectively. By using the mouse, the two smaller spheres can be picked. Clicking the left
mouse button will turn the light sources on and off, while clicking using the right button
will change its color. The resulting visual effect is illustrated in Figure 14.
In this application, it should be clear that using PickRay may not give satisfactory
results as the smaller spheres are too small to be easily picked. Instead, using PickCone
will be more appropriate as it will be easier for the spheres, despite their small size, to be
intersected by a conic picking shape.
Another point to note is that the application actually requires the development of a
program that modifies other objects as the user clicked on another one. This is sometimes
necessary if the object to be modified in the live scene graph is transparent or cannot be
Figure 14. Result from
Top right light
switched off
Both lights
switched off
Original color
Color changed
Search WWH ::

Custom Search