19.2 INTUITIVE MAPPING
As described in chapter 4, intuitive coordinate mapping, such as DRM and WRM,
utilize control source and target spaces. In many respects, the InputDragMapper class
described in an earlier chapter was a shortcut that went from 2D device input straight
to 4D actuation output, completely bypassing the intermediate 3D source and target
spaces required for intuitive mapping. The resulting control chain got things moving,
so to speak, but not in a very intuitive manner. This section takes a more in-depth
look at source and target spaces, and describes the framework's support for a longer
and more effective control chain, with additional links that permit more generalized
and, as a result, more intuitive interpretation of control inputs.
19.2.1 Source and target spaces
The seeds for understanding the role of the source and target space in intuitive map-ping
were planted in both parts 2 and 3 of the book. Chapter 4 discussed the general
problem, and chapter 13 addressed the specific notion of world versus local spatial
coordinates, and how local-to-local transforms can be useful. The matter boils down
to one of spatial interpretation. When the user drags a mouse in the display, is the
drag simply a change in mouse X and Y value, or should it be interpreted as a drag
across a horizontal floor or a vertical wall in the context of the scene? When the control
input is applied to an actuator, is it simply applied with respect to the target's
local coordinate system, or should it be applied relative to the floor that the object is
sitting on, or the wall to which it is attached?
When the user drags the mouse over a floor or wall in the scene, rather than thinking
of the drag as a change in mouse X and Y value, it can be interpreted relative to the 3D
space defined by those objects. Depending on which object is under the mouse, the
2D drag can be interpreted as being parallel to the horizontal floor or the vertical wall,
in 3D space. This 3D motion could be considered a generalized form of drag input, as
if we weren't dealing with a POCS and the user had waved a 3D mouse through the
scene, over the floor or along the wall. As with its 2D counterpart, this generalized 3D
drag input can be filtered, such as for absolute and relative origin, clamping and scaling,
and even gestures, only in 3D.
An example using third-person controls might help to further illustrate the role
of the 3D source space in the control chain. Normally we think of third-person controls
as being virtual knobs and sliders in the application window. The user is expected
to manipulate these controls as if they were pasted to the display screen. Now imagine
that these controls were instead pasted to the floor and walls in the 3D scene. Using
a "3D mouse," the user could reach into the scene and turn a knob on the floor or slide
a knob on the wall. Although the user interaction is occurring in 3D, the effect on the
actuation targets of the controls is the same as in the 2D case. The notion of a source
space is simply a more generalized way to specify what a control drag is in reference
to. Instead of the source space always being the display plane, it can now be any plane
in the virtual world. In fact, it doesn't even have to be a plane. It could be the rolling
surface of 3D terrain or the surface of an arbitrarily complex 3D shape.
Target space
As defined in the previous chapter, the actuation space is a 4D space that directly controls
the actuator target's dynamic state. In a translation actuator connected to a
transform group, when the actuation X value changes by 10 units, the target's transform
state is modified accordingly, with the target group's children moving 10 units
in a direction defined by the group's local coordinate space. If you instead wanted the
X input to move the target relative to some other space in the scene, such as the floor
or a wall, then a spatial transform would be needed, with the target space defined by
the local coordinate system of the target object. In the general case, a local-to-local
transform would convert the input source value from its local coordinate space to that
of the target's.
19.2.2 Control chain spaces
Putting the source and target pieces together, there are a total of four spaces: 2D
input, 3D source, 3D target, and 4D actuation. Correspondingly, there are three
coordinate mappings: The 2D device input is interpreted relative to some 3D source
space, converting it into a 3D source Input. In turn, this generalized 3D source value
is converted into a generalized 3D target value by means of a local-to-local spatial
transform, such as that defined in chapter 13 using the getLocalToVworld
Figure 19.3 Relationship of classes and interfaces related to intuitive coordinate mapping
methods of a source and target Java 3D Node object. The target value is then
mapped into an actuation value, similar to that done by InputDragMapper, only
here it is from 3D to 4D space instead of from 2D to 4D space. To simplify things,
the framework exposes only the source space for processing with filter blocks, and
the target and actuation transformations are combined into a single building block,
with only the input source and output actuation interfaces exposed.
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.
|