# Spring 1999 CS302 Assignment #4

by Dan Garcia `(ddgarcia@cs.berkeley.edu)`

## Choose one of the homework exercises you've designed already, and produce an outline of a case study of its solution. Attempt to identify all applications of expertise in the solution and why the expertise was applicable at each point. Also identify decision points one might encounter in the solution and criteria an expert might use to make the decision.

### Problem Description

Using the basic geometrical objects of Infini-D, implement the hierarchical figure you designed last week. You will find the excel spreadsheet you created last week extremely helpful here. Within Infini-D, the text-entry positioning tool is the tool of choice, as it allows you to directly enter the values from your spreadsheet into the system to set up your figure.

### Exercises

 Analysis 1 You are a novice implementing a single arbitrary hierarchical figure into a 3D animation program. Describe an optimal interface for doing this. Analysis 2 You are an expert implementing 500 arbitrary hierarchical figures into a 3D animation program. Describe an optimal interface for doing this. Reflection What was different, if anything, between the answer to exercise 1 as compared to exercise 2? One important consideration in user interface design is to know the intended use of your program and the intended users. Often a program intended for experts (like one used by a telephone operator) will have a more efficient, but harder to master interface, than one intended for one-time users (like in a kiosk).

### Preparation

The student is expected to have completed last week's assignment and has taken the Infini-D tutorial explaining the basic tools of the program.

### Understanding the problem for ourselves

Before we even boot Infini-D, let's think what the overall goal is. We'd like to take these 2D plan views of our figure from last week's assignment (we'll use the demonstration figure throughout this case study):

and this matrix we created of the components in our object

 Tx Ty Tz Tx flat Ty flat Tz flat Rx Ry Rz Sx Sy Sz Cy Cx Cz Floor 0 0 0 0 0 0 0 0 0 1 1 0.1 Ceiling 0 0 6 0 0 6 0 0 0 1 1 0.1 Body 0 0 3 0 0 3 0 0 0 1 0.5 1 1 -Head 0 0 2 0 0 5 0 0 0 0.5 0.25 0.5 0.5 -LShoulder 1.25 0 1.5 1.25 0 4.5 0 0 0 0.25 0.25 0.25 --LUpperArm 0 0 0 1.25 0 4.5 0 0 0 0.25 0.25 0.5 -0.5 ---LElbow 0 0 -1 1.25 0 3.5 0 0 0 0.25 0.25 0.25 ----LLowerArm 0 0 0 1.25 0 3.5 0 0 0 0.25 0.25 0.5 -0.5 -----LWrist 0 0 -1 1.25 0 2.5 0 0 0 0.25 0.25 0.25 ------LHand 0 0 0 1.25 0 2.5 0 180 0 0.25 0.25 0.25 0.25 -RShoulder -1.25 0 1.5 -1.25 0 4.5 0 0 0 0.25 0.25 0.25 --RUpperArm 0 0 0 -1.25 0 4.5 0 0 0 0.25 0.25 0.5 -0.5 ---RElbow 0 0 -1 -1.25 0 3.5 0 0 0 0.25 0.25 0.25 ----RLowerArm 0 0 0 -1.25 0 3.5 0 0 0 0.25 0.25 0.5 -0.5 -----RWrist 0 0 -1 -1.25 0 2.5 0 0 0 0.25 0.25 0.25 ------RHand 0 0 0 -1.25 0 2.5 0 180 0 0.25 0.25 0.25 0.25 -LHip 0.5 0 -0.25 0.5 0 2.75 0 0 0 0.25 0.25 0.25 --LUpperLeg 0 0 0 0.5 0 2.75 0 180 0 0.25 0.25 0.5 0.5 ---LLowerLeg 0 0 1 0.5 0 1.75 0 0 0 0.25 0.25 0.75 -0.75 ----LFoot 0 0 -1.5 0.5 0 0.25 0 0 0 0.25 0.5 0.125 -0.25 -0.125 -RHip -0.5 0 -0.25 -0.5 0 2.75 0 0 0 0.25 0.25 0.25 --RUpperLeg 0 0 0 -0.5 0 2.75 0 180 0 0.25 0.25 0.5 0.5 ---RLowerLeg 0 0 1 -0.5 0 1.75 0 0 0 0.25 0.25 0.75 -0.75 ----RFoot 0 0 -1.5 -0.5 0 0.25 0 0 0 0.25 0.5 0.125 -0.25 -0.125

and create an Infini-D file that has exactly the same elements that we may begin animating:

### Designing a plan of attack

Let's think about how we want to begin the assignment. There are three high-level approaches:

• Top down, where the top is the root of the tree, Body.
• Bottom up, where the bottom are the leaves of the tree, RFoot, Lfoot, RHand and LHand.
• Any particular order, as long as we make sure to add all the elements of the figure.

Stop and consider (what an expert asks herself) What is the advantage of each approach? Does the problem immediately lead to one over the other? Are any of the approaches wrong? Does the symmetry in the object lead us to one particular approach? Can we somehow save ourselves redundant work?

as well as another decision to be made. Should we link up each object with its parent (if it exists already):

• at the end, after the whole figure is entered into the program?
• as we enter them, so at each stage we at least have a completed figure?

Stop and consider (what an expert asks herself) What is the advantage of each approach? Does the problem immediately lead to one over the other? Are any of the approaches wrong? Does the symmetry in the object lead us to one particular approach?

### Analysis of the hierarchical structure

Let's take a second and look at what our hierarchy looks like as a tree. It's clear from this particular figure that many geometrical objects are similar. The joints in particular all seem to be small spheres. Would we like our tree to have:

• copies of the geometric objects
• pointers to the same geometric object
• an intermediate approach where they all point to the same object but can override some of the values (shape, texture, etc) if need be

Stop and consider (what an expert asks herself) What is the advantage of each approach? For each, can you think of a situation where that method is the clearly the winner? What does Infini-D allow us to do? Are there higher-end packages which allow more flexibility? When the program allows us to "duplicate" an object or subtree, is that making a copy or adding another pointer to the same object?

### Let's begin creating our figure!

Let's assume we're taking a top-down approach. So the first object we'll enter is the body. We choose the cube tool and click somewhere in the window.

Expert advice If we click and hold, the program allows us to drag up and down to change the size of the object. Is that what we want to do here? Does precision count? Why did Dan tell us to edit the size of the object witht the text-entry box if we can modify this value with the mouse?

Now there is a cube named (by default) Cube positioned arbitrarily in our world. We look at our chart and see what parameters we need to adjust for it. We need to modify the name, position, scale and center point. Let's bring up the text-entry box and modify some values.

Expert advice Clicking the key allows us to quickly cycle between fields. goes back to the previous field.

After we're done, the text box should look like this:

Stop and consider (what an expert asks herself) Note that the dialog box asks for cartesian coordinates. Will deference to René Descartes, is that the best coordinate system in which to operate for this application? Are other applications where other coordinate systems (spherical, cylindrical) might be more intuitive / efficient? Should a program allow the user to choose the coordinate system?

We also change the name of the object from Cube to Body. In fact, let's be more specific and name our root BodyDDGrobot (where DDG is the initials of the design creator) in the field modification box.

Stop and consider (what an expert asks herself) Why do we change the default names of the objects? Why not leave them as Cube, Cube1, Cube2, etc? Why do we add our initials and a quickie description of the figure to the name? What would happen if we were to import our partner's object into our world and both figures had root names of Body?

### Let's add another element to our figure

Let's add the head. Are you beginning to feel like Dr. Frankenstein? Make sure not to choose the head labeled "ab-normal", as in the great Mel Brooks' movie "Young Frankenstein". Our head is a squashed sphere, so we choose the sphere tool and click to add another object into the world. We edit the name / size / rotation / etc. parameters and now have two objects placed at the top level, one named BodyDDGrobot and one named Head. Let's link the two objects together, so if we turn the body to the right the head follows.

Stop and consider (what an expert asks herself) If you've ever seen the cartoon the Roadrunner you'll recall what happens whenever Wile E. Coyote notices he's run off the cliff. He doesn't fall until he looks down. When he does begin to fall, first his feet fall, then his legs, then his body, then his head, as if they're connected by springs. Think how you might implement this into your hierarchy. Would you want a realistic physical model of a spring and damper? Woud you want the control to change the laws of physics to suit you in interesting ways? Would you want to have to manually change every component or would you want some parts of the system be secondary animation, like the way clothes move?

We can link the two objects in several ways, all of which are described in the manual.

Expert advice The manual is an invaluable source of information. It's often good to understand several ways to do things. Initially users may choose the tools or menu, but eventually most experts use the key shortcuts for almost all actions. You may wish to learn these shortcuts to save time entering information.

We'll choose what may be the most direct method of linking two objects. In the sequencer you'll see both objects, Body and Head. Drag the child, Head onto Body. You'll notice it becomes listed below Head and indented. This means it's the child of Head. Check the text fields for Head. Note that the z position moved from 5 (flat) to 2. This means it's only 2 units away from its parent, and since it's parent is only 3 units away from the world origin, it's overall position remains unchanged.

### Verifying correctness

Let's now look at the objects we've created to verify the two objects seem to be placed correctly. There are two ways of doing this:
• Rotating the objects we have so far (by rotating the root if we've linked them)
• Rotating the camera around some fixed point, keeping it pointed at the same point.

Stop and consider (what an expert asks herself) Which of these is better, in general? What are our options if we haven't hierarchically linked the objects yet? How often should we verify that the objects we've created so far are correct? Should we wait until we've implemented all of the objects to check to see if they're positioned correctly?

You may find it useful to add a verification camera for the sole purpose of zooming into some areas or rotating around an object to make sure it looks fine from certain directions. It's easy to add a camera: Click on the camera icon on the top and click anywhere in the scene in any window.

Expert advice The window and position you click only determines the object's (or camera's) position, it doesn't determine the orientation, which is default for each object to be aligned facing the z=infinity axis.

Two objects are created, Camera 1 and Camera 1 target, an invisible object. The camera always looks at its target. If you move the target to a certain place, you can easily position the camera by choosing the rotate camera tool which spins the camera keeping it fixed on its target. You can tell that you're rotating the camera and not the world because when you move the camera the floor moves too (in your frame of reference). When you move the object the floor remaines fixed.

Expert advice Don't underestimate the value of the default ground plane. You have the option of turning it off (check inside the edit:preferences for other defaults you can modify) but I wouldn't suggest it. It's never rendered during your final render or animation and is very helpful for orienting yourself in space during the build / debugging phase.

Position the Camera 1 target somewhere that will allow you to quickly verify if you've built the objects right. Where in this case would it be appropriate to position the target?
• The origin
• The last object's origin
• The center of mass of all the objects we've created so far
• The center of mass of all the objects we're debugging right now

Stop and consider (what an expert asks herself) Does it matter whether you position the camera target precisely with the text entry box or with the mouse? Give a situation where each of the above placements for the camera target makes the most sense, if any.