Computer Graphics Workshop '96 Problem Set 1
limit coredumpsize 0This will prevent the interpreter from trying to dump large amounts of debugging information into your home directory (or elsewhere).
If you have an error in your Scheme program, you will probably get an error message. If this happens your Inventor windows will stop updating. To fix this, just type a number (i.e. 4) into the interpreter; this will evaluate properly, and you can then look back and fix the line of code which caused the interpreter to fail.
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.
$Id: index.html,v 1.1 1996/01/02 21:56:42 kbrussel Exp kbrussel $