CSCI480/582 Lecture 8 Chap.2.1 Principles of Key

Download Report

Transcript CSCI480/582 Lecture 8 Chap.2.1 Principles of Key

CSCI480/582 Lecture 12 Chap.3.1
Hierarchical Modelling and
Forward Kinematics
Feb, 18, 2009
Outline



Articulated motion in general
Hierarchical Modelling
Forward Kinematics
Objects of “linked” parts

A “link” is a physical connection made of





Mechanical joint with visible geometric structures
Gravity force without visible structures
Magnet Field Force
“Invisible” metal wires in Magic shows, etc.
Motions of one part is relative to its “linked” part


Which forms a Motion Hierarchy
The geometric transformation model of a linked part
has reduced degree of freedom due to the constraints
defined by the link
The Kinematics of Linked Objects

Data structure that supports link constraints


e.g. Human body defined by a hierarchy of rotational
joints connected by rigid shapes
Determine geometric transformation model
during animations


Forward kinematics: Joint rotation/translation
parameters are directly specified to determine the
motion
Inverse kinematics: Desired position of leaf-node
parts (parts that has no linked part whose motion is
relative to it) are specified, the application solves the
rotation/translation parameters that meets the
specifications.
Hierarchical Modelling – Basics



The enforcement of relative location constraints
among objects organized in a tree
Articulation: The movements of an appendage
by changing the configuration of a joint
Joint constraints:

Joint Degree of freedom (DOF): minimum number
of parameters to define the motion allowed by a joint
Revolute Joint
Presmatic Joint Ball-and-socket Joint
Hierarchical Modeling – Data Structure

Linkage represented by a tree structure of

Nodes connected by Arcs
ArccurrContains
 A constant transformation MScurr of
Linkcurr relative to linkparent
 A variable transformation MAcurr
responsible for articulating Nodecurr
Nodecurr
 Constrains of the transformation
variable
Contains
 Object
Root Node
data
Abstract
hierarchical
representation
of an articulated
figure
Tree
structure
Draw an Articulated Model in Forward
Kinematics in OpenGL

Direct display without node-arc data structure
Partial code in display()
glutSolidSphere( 0.5, 32, 32 );
glPushMatrix();
glRotatef( earth2sunRotate, 0.0, 1.0, 0.0 );
glTranslatef( 4.0, 0.0, 0.0 );
glPushMatrix();
glRotatef( earthSelfRotate, 0.866, 0.5, 0.0 );
glutSolidSphere( .05, 32, 32 );
glPopMatrix();
glPushMatrix();
glRotatef( moon2earthRotate,0.0, 1.0, 0.0 );
glTranslatef( 0.2, 0.0, 0.0 );
glutSolidSphere( 0.03, 32, 32 );
glPopMatrix();
glPopMatrix();
void idle()
{
if ( animationMode == 1 )
{
earth2sunRotate += 0.5;
moon2earthRotate += 6.5;
earthSelfRotate += 20;
glFlush();
glutPostRedisplay();
}
}
Draw an Articulated Model in Forward
Kinematics – Transverse The Tree
Abstract Node class
Class Node
{
virtual void draw();
};
Abstract Arc class
Class Arc
{
virtual void draw()
{
glPushMatrix()
glLoadMatrix( (GLfloat*) A_ );
glPushMatrix();
glLoadMatrix( (GLfloat*)T_);
node_.draw();
Segments of the main program
/// create the hierarchical tree
Std::vector<Node> nodeList;
Std::vector<Arc> arcList;
/// draw the tree
arcList[0].draw();
}
for( int i = 0; I < children_.size(); ++i )
children_[i].draw();
glPopMatrix();
glPopMatrix();
Private:
Arc* parent_;
std::vector<Arc> children_;
Node* node_;
ModelMatrix T_;
ModelMatrix A_;
}