 |
» |
|
|
 |
Picking is the means of identifying
which parts of a segment network fall within a specified space,
or pick aperture. A common use of picking
is to take a location returned from an input device to define the
location of the pick aperture, the size of the pick aperture being
some reasonable size, and pass all segments represented on the display
device through the picking operation to determine which segment(s)
and corresponding element(s) fall near the location defined by the
input device. The picking process in the context of Display List is very
similar to the picking process in the context of "raw" Starbase.
Most of the steps are identical; only a few are different. One possible
approach is described below: Set
up some kind of cursor-tracking feedback mechanism. You can use
the Starbase routine track,
or you can set up a special-purpose cursor-tracking mechanism yourself. Specify the type of echo you want via echo_type. Wait for the user to pick an object on the display
(via request_locator). Assuming the point returned was valid, define the
pick window using set_pick_window. Using the 〈found〉
parameter returned from pick_from_segment,
determine if anything was hit. If something was hit, interrogate Display List to
determine what was hit, and use the information as desired for your
application.
Both the position and size of the pick aperture are defined
using the Starbase calls set_pick_window
and set_pick_depth
(see the Starbase documentation for more information on these calls).
It should also be noted that picking is not directly coupled to
any particular input device. If desired, the application can define
a pick aperture based on input device values, thereby relating picking
to input device values. What Can Be Picked? |  |
A primitive that can be picked is a primitive that is: Visible. The primitive must not be
invisible by being in the set of invisible objects in the context
of the invisibility filter. Pickable. The primitive must not be considered by
the unpickability filter. Unclipped. The primitive must not be outside the
clip limits. Unobscured. In the case of 3-Dimensional picking
with hidden surface removal, using a device with a Z-buffer, if
two primitives are inside the pick aperture and the second primitive
covers the first primitive because of hidden surface removal, then
the second primitive will produce a hit and the first one will not
because it is obscured. Detectable. With element control, a primitive with
its visibility flag set to DISP_IGNORE
and its pickability flag not set to PICK_IGNORE is invisible,
but can be picked. In a detectable segment; that is, segment control
flags of the segment containing the element do not include PICK_IGNORE. Not a Device Coordinate (DC) - primitive (e.g.,
dcdraw, dcpolyline, dcpolygon, etc.). Not a partial-
primitive (e.g., partial_polygon3d,
partial_arc,
partial_ellipse,
etc.).
 |  |  |  |  | NOTE: For the devices HP 98705 and HP 98766, with hidden surface
removal activated, the primitive picked is determined by the following
conditions: First, the primitive closest to
the center of the pick aperture. Second, the primitive closest
in Z. |  |  |  |  |
 |  |  |  |  | NOTE: When a Hidden Line/Hidden Surface Removal (HLSHR) pick
is executed in an application, the Z-buffer is used. A pick can
normally be done to an obscured window without a problem. However,
if a pick is performed with Hidden Line/Hidden Surface Removal enabled,
the Z-buffer for obscured regions of a window becomes undefined
requiring that the Z-buffer be cleared before the application executes
any drawing primitive. For predictable results, do not use HLHSR
when picking to obscured windows. |  |  |  |  |
The set_disp_traversal_control
and set_pick_traversal_control
calls also influence which primitives are picked. If pick traversal
encounters either a pick-control element or a display-control element,
and the control element is TRAVERSAL_ABORT
or TRAVERSAL_RETURN,
the segment structure from that point on will not be traversed.
Any primitives in that part of the structure can not be picked simply
because they are not processed.
|