|
19.4 WORLD-RELATIVE MAPPING
WRM is a dynamic coordinate mapping technique that controls a target object
according to world-relative inputs, such as the projection of the drag cursor position
onto a floor or wall in the scene. In terms of source and target spaces, the most
general form of WRM uses object picking to determine the current source space node,
and the actuator's target transform group as the target space node.
At a conceptual level, the WRM process can be summarized as follows: When the
user moves the drag cursor over an object in the scene, the intuitive drag mapper
interprets that motion as occurring in the scene relative to the object underneath the
cursor, which is the source node. In turn, the source drag mapper obtains the source
node's local-to-Vworld transform, and transforms the local movement on the node's
surface into the equivalent motion expressed in absolute world space coordinates, such
as movement in a northerly direction. The mapper then obtains the actuator target's
local-to-Vworld transform, inverts it, and then transforms the world space movement
into an equivalent motion in the target's local coordinate space. If, for example, the
target actuator performs geometric translation, then the target object will always
appear to move north in the world regardless of the position or direction of the view.
Table 19. 4 summarizes the classes associated with WRM intuitive mapping.
Figure 19.6 illustrates the relationship of these classes. The next example will demonstrate
how to configure these and the rest of the intuitive mapping building blocks
for WRM.
Table 19.4 Summary of classes related to WRM intuitive mapping
| Class/ Interface | Description | Input Events | Output Events |
| IntutiveDragMapper | A coordinate mapper for
input drag to source drag
conversion. Uses a plug-in to
perform a specific type of
coordinate mapping
| InputDragTarget | SourceDragTarget |
| IntuitiveDragMapperPlugin | The abstract base class for
intuitive drag mapper plug-ins.
| | |
| WrmPlugin | An intuitive drag mapper
plug-in that uses a pick
engine to perform the most
general form of WRM. It
also serves as the base class
for less general WRM mappers
| | |
| QuasiWrmPlugin | A WRM plug-in that performs
true WRM at the start of a
drag, and uses a picking
plane during the drag
| | |
| PseudoWrmPlugin | A quasi-WRM plug-in that
performs a mapping that can
approximate WRM. It uses a
pick engine to place a picking
plane on the target node for
use during the drag
| | |
19.4.1 WrmDragPlugin class
For support of WRM, the framework provides the WrmDragPlugin subclass of IntuitiveDragMapperPlugin.
The class has several constructors. The single-parameter constructor
is for the most general form of WRM. It uses the PickEngine object supplied
Figure 19.6 Relationship of classes related to WRM intuitive mapping
to the constructor to select the source node lying under the drag cursor, which serves
as both the drag surface and the dynamic source reference space. The source space reference
node is also passed along with the mapper's output SourceDragTarget event for
use by the source drag Mapper. The candidate source nodes with which the mapper is
to work must be provided in the pick engine's target list. The mapper will generate
output events only while the cursor is being dragged over a valid source target.
A second constructor, which takes a source node as its second argument, creates
a WRM mapper that works much like the previous one, but the picked source nodes
provide only the drag surface. The specified source node defines a static source reference
space used for source mapping. A third constructor, which takes no arguments,
serves as a special base class for pseudo-WRM, which is discussed in a later section.
Absolute input drag
An important note about WRM is that it will not work with a relative input drag origin.
The input drag position for WRM must be absolute; otherwise, the picking that
it performs will be incorrect. Because relative dragging is still a desirable feature, it
must be performed after the WRM intuitive mapping, by a source drag filter, such as
a SourceDragFilter with a RelativeSourceDragPlugin.
Sticky cursor
Because the source drag position is on the surface of the source node, by default, during
a translation operation the target object's origin will appear to follow the drag cursor.
With this arrangement, depending on the shape of the object and the angle of
view, the target object may not always appear to be stuck to the cursor— the target
object may appear to drift away from the cursor as the drag progresses and the relative
viewing angle changes. Sometimes this is acceptable, but often a sticky cursor will
seem more intuitive than a not-so-sticky one.
Although not included in the framework, one variation on WRM that would
allow it to have a sticky cursor would be to determine the hit point on the target object
first, and then project a ray from the hit point to the reference source object. The position
of the hit point could then be computed relative to the source reference space,
and then used to make the target stick to the cursor during manipulation. Of course,
if there are multiple source objects, then there is the question of which source object
to use as the reference space. The answer will likely be application-specific. As you'll
see shortly, the technique called pseudo-WRM can provide cursor stickiness, although
the operation overall is quite restrictive in comparison to true WRM.
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|