Computer Graphics Workshop '97 Problem Set 1
Hint: you can get rid of old examiner viewers by double-clicking the "close" button in the upper left corner, or by using the hide message in the same way you use the show message.
Construct each of the objects and add it to the root node, as shown in today's lecture. Don't forget to ref your root node! Once you have created all the objects, create a viewer and set its scene graph to be the root node. You should now see a cube on the screen, assuming you have not modified any of the transforms.
Now modify, in order, the eye, nose, and mouth transformations to create the face. You will be using the translation field of the SoTransform node, as shown in lecture. Remember that the positive X axis is to the right, the positive Y axis is up, and the positive Z axis is out of the screen. (You should not need to change the Z translations of any of the objects.)
Note that all of the objects after the transformation you are modifying follow along when you change that transformation. For example, once you have created the face, increase the eye translation, and note that the nose and mouth move along with the right eye.
This happens because transformations are cumulative; each transformation modifies the current transformation matrix, which defines the relationship between the world coordinate system and the objects' coordinate systems.
An SoSeparator node has two important properties: it can group nodes together under it, and it separates nodes in the following manner: no node under a separator can affect any node above and to the right of it. That is, a transformation node under a separator node will not affect any objects following that separator in the scene graph.
This new topology allows each object to be moved about independently of the others. Modify the transformations to recreate the shape of the face.
;; ... code above this ... (define right-eye-sep (new-SoSeparator)) (-> root 'addChild right-eye-sep) (define right-eye-transform (new-SoTransform)) (-> right-eye-sep 'addChild right-eye-transform) (-> (-> right-eye-transform 'translation) 'setValue 3 0 0) ;; ... code below this ...Now replace all instances of the word "SoTransform" with the word "SoHandleBoxManip"; that is, the line
(define right-eye-transform (new-SoTransform))would become
(define right-eye-transform (new-SoHandleBoxManip))Reload the code into the Scheme interpreter and view the resulting scene graph. Each object should have a box surrounding it; click on the arrow button on the upper right side of the examiner viewer, and then click and drag on one of the boxes; note that the objects translate to follow your mouse. Manipulators are subclasses of SoTransform; they are special objects that know how to detect mouse button presses and respond to clicking and dragging. Other kinds of manipulators include SoTrackballManip, SoTabBoxManip, and SoJackManip.
The point of this problem is to illustrate the ease with which Inventor handles some very hard problems: 3D interaction via mouse clicks is non-trivial. We will see later how to use the output of Inventor's user interface elements to affect the behavior of a program.
$Id: index.html,v 1.3 1997/01/02 01:49:55 kbrussel Exp $