Picking

Picking is a bread and butter user interface technique for 3D. There are many forms of picking which we will discuss shortly, but the general idea is that picking is the process of selecting an object or polygon with an input device.

A general algorithm for picking is depicted in Figure 12.4, and the steps are as follows:

1.
Convert the mouse click or other input event into the display device coordinates (that is, screen).
2.
Cast a ray from the user's eye position through the display device coordinates.
3.
Convert the ray into the virtual space.
4.
Test for the intersection of any eligible model parts with the ray and report these as picked.
Figure 12.4. Ray casting. The user shoots an arrow from the eye through the screen and ...

Get Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.