CHAPTER 10 - Implementation 1

Objectives <next>


Instance Transformation


Symbol-Instance Table


Relationships in Car Model


Structure Through Function Calls

car(speed) {

chassis()
wheel(right_front);
wheel(left_front);
wheel(right_rear);
wheel(left_rear); }

Graphs


Tree


Tree Model of Car


DAG Model


Modeling with Trees


Robot Arm


Articulated Models

  • Robot arm is an example of an articulated model
    • Parts connected at joints
    • Can specify state of model by giving all joint angles


Relationships in Robot Arm

  • Base rotates independently
    • Single angle determines position
  • Lower arm attached to base
    • Its position depends on rotation of base
    • Must also translate relative to base and rotate about connecting joint
  • Upper arm attached to lower arm
    • Its position depends on both base and lower arm
    • Must translate relative to lower arm and rotate about joint connecting to lower arm

Required Matrices

  • Rotation of base: Rb
    • Apply M = Rb to base
  • Translate lower arm relative to base: Tlu
  • Rotate lower arm around joint: Rlu
    • Apply M = Rb Tlu Rlu to lower arm
  • Translate upper arm relative to upper arm: Tuu
  • Rotate upper arm around joint: Ruu
    • Apply M = Rb Tlu Rlu Tuu Ruu to upper arm

OpenGL Code for Robot

robot_arm() {
glRotate(theta, 0.0, 1.0, 0.0);
base();
glTranslate(0.0, h1, 0.0);
glRotate(phi, 0.0, 1.0, 0.0);
lower_arm();
glTranslate(0.0, h2, 0.0);
glRotate(psi, 0.0, 1.0, 0.0);
upper_arm(); }

 


Tree Model of Robot

  • Note code shows relationships between parts of model
    • Can change “look” of parts easily without altering relationships
  • Simple example of tree model
  • Want a general node structure for nodes

Possible Node Structure


Generalizations

  • Need to deal with multiple children
    • How do we represent a more general tree?
    • How do we traverse such a data structure?
  • Animation
    • How to use dynamically?
    • Can we create and delete nodes during execution?

<next>