111/16/2015 07:14 uml instance transformation x y z x y z x y z x y z srt model coordinates

27
1 06/20/22 19:32 UML Instance Transformation x y z x y z x y z x y z S R T Model Coordinates

Upload: gladys-lang

Post on 05-Jan-2016

224 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

104/20/23 18:02

UML

Instance Transformation

x

y

z

x

y

z

x

y

z

x

y

z

S R T

ModelCoordinates

Page 2: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

204/20/23 18:02

UML

Instancing in OpenGL

glMatrixMode(GL_MODELVIEW);glLoadIdentity();glTranslatef(...);glRotate(...);glScale(...);glutSolidCylinder(...); /*or some other symbol*/

Symbol Scale Rotate Translate

Cylinder sx, sy, sz x,y, z dx,dy,dz

Cylinder . . .

Sphere

Tabular Representation

Page 3: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

304/20/23 18:02

UML

Example of a Linked Structure: Robot Arm

yy y

x x x

zzz

Page 4: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

404/20/23 18:02

UML

Moving Robot Components and Frames

h1

h2

Base : Ry ()

Lower Arm : R y ()T(0, h1 ,0)Rz ()

Upper Arm : R y ()T(0, h1, 0)R z ()T(0,h2 ,0)Rz ( )

Page 5: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

504/20/23 18:02

UML

Robot Construction

Base : Ry ()

Lower Arm : R y ()T(0, h1 ,0)Rz ()

Upper Arm : R y ()T(0, h1, 0)R z ()T(0,h2 ,0)Rz ( )

display(){

glRotate(theta, 0.0, 1.0, 0.0);base();glTranslatef(0.0, h1, 0.0);glRotatef(phi, 0.0, 0.0, 1.0);lower_arm();glTranslatef(0.0, h2, 0.0);glRotatef(psi, 0.0, 0.0, 1.0);upper_arm();

}

Page 6: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

604/20/23 18:02

UML

Hierarchical Structure

Base

LowerArm

UpperArm

* Draw Func.

Transform

* Child(ren)

display(){

glRotate(theta, 0.0, 1.0, 0.0);base();glTranslatef(0.0, h1, 0.0);glRotatef(phi, 0.0, 0.0, 1.0);lower_arm();glTranslatef(0.0, h2, 0.0);glRotatef(psi, 0.0, 0.0, 1.0);upper_arm();

}

Page 7: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

704/20/23 18:02

UML

Tree Representation of More Complex Robot

Torso

HeadLeft Upper

ArmRight Upper

ArmLeft Upper

LegRight Upper

Leg

Left LowerArm

Right LowerArm

Left LowerLeg

Right LowerLeg

Page 8: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

804/20/23 18:02

UML

Tree with Transformations

Torso

HeadLeft Upper

ArmRight Upper

ArmLeft Upper

LegRight Upper

Leg

Left LowerArm

Right LowerArm

Left LowerLeg

Right LowerLeg

Th Tlua Trua Tlul Trul

Tlla Trla Tlll Trll

Page 9: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

904/20/23 18:02

UML

Traversing the Tree

Torso

Head Left UpperArm

Right UpperArm

Left UpperLeg

Right UpperLeg

Left LowerArm

Right LowerArm

Left LowerLeg

Right LowerLeg

Th Tlua Trua Tlul Trul

Tlla Trla Tlll Trll

figure(){Torso();glPushMatrix();glTranslatef(...);glRotatef(...);Head();

glPopMatrix(...);glPushMatrix(...);

glTranslatef(...);glRotatef(...);LeftUpperArm();glTranslatef(...);glRotatef(...);LeftLowerArm();

glPopMatrix(...);glPushMatrix(...);

glTranslatef(...);glRotatef(...);RightUpperArm();glTranslatef(...);glRotatef(...);RightLowerArm();

T

T•Th

T

T•Tua

T•Tua•Tlla

T

T•Trua

T•Trua•Trla

CurrentTransform.

Page 10: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

1004/20/23 18:02

UML

Scene Graphs

Scene

Translate

Translate

Translate

Rotate Rotate

Object 1 Object 2

Object 4

Object 3

Page 11: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

1104/20/23 18:02

UML

Scene GraphsTraversing the Graph glPushMatrix();

glTranslate(...);glRotate(..._;

Object1();

glPopMatrix();glPushMatrix();glTranslate(...);

Object2();

glPopMatrix();glPushMatrix();

glTranslate(...);glRotate(...);

Object3();

glPopMatrix();glPush Matrix();

Object4();

Scene

Translate

Translate

Translate

Rotate Rotate

Object 1 Object 2

Object 4

Object 3

Page 12: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

1204/20/23 18:02

UML

Architecture for Graphics on the Internet

Model Application APIGraphicsPipeline

Display

UI

TCP/IP

Server

TCP/IPTCP/IP

ModelGraphicsPipeline

GraphicsPipeline

UI UI

Display Display

Browser Browser

Network/Internet

Page 13: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

1304/20/23 18:02

UML

VRML Design Goals

0 Composability0 Scalability0 Extensibility0 Simple authoring

Page 14: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

1404/20/23 18:02

UML

VRML 2.0 Scene Graph Structure

Group

Transformation

Shape

Nodes

Page 15: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

1504/20/23 18:02

UML

VRML 2.0Node Format

Node_Name {field_name field_valuefield_name field_value

.

.

.field_name field_value}

Each field has an associated class and type. Field classis one of:

field, exposedfield, eventIn, enventOut

Page 16: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

1604/20/23 18:02

UML

VRML 2.0Field Types

SFBool The Boolean value TRUE or FALSE

SFFloat A 32-bit floating point value

SFInt32 A 32-bit signed integer

SFTime An absolute or relative time value

SFVec2f A pair of floating point values, usually used to represent texture coordinates

SFVec3f Three floating point values, usually used to represent a 3D position

SFColor Three floating point values between zero and one, used to represent RGB

SFRotation Four floating point values. The first three represent an axis, the fourth an angle

Page 17: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

1704/20/23 18:02

UML

VRML 2.0Field Types

SFImage A two-dimensional image with one to four color components

SFString A UTF8 (international character) string

SFNode A container for another VRML node

MFFloat An array of SFFloat values

MFInt32 An array of SFInt32 values

MFVec2f An array of SFVec2f values

MFVec3f An array of SFVec3f values

MFColor An array of SFColor values

MFRotation An array of SFRotation values

MFString An array of SFString values

Page 18: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

1804/20/23 18:02

UML

VRML 2.0Composing Node Hierarchies

Node_name_1 {field_name field_valuefield_name Node_name_2 {

field_name field_valuefield_name field_value}

field_name Node_name_3 {field_name field_valuefield_name field_value}

}

1

2 3

Page 19: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

1904/20/23 18:02

UML

VRML 2.0The Shape Node Definition

Shape {exposedField SFNode appearance NULLexposedField SFNode geometry NULL

}

Node Name

Field Class Field Type

Field Name

Default Value

Bold values are what is actually typed in source file.

Page 20: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

2004/20/23 18:02

UML

VRML 2.0Geometry Nodes

0 Predefined shapes- Cone- Box- Cylinder- Sphere

0 PointSet0 IndexedLineSet (polyline)0 IndexedFaceSet (polygonal object)0 ElevationGrid0 Extrusion0 Text

Page 21: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

2104/20/23 18:02

UML

VRML 2.0Cone Definition

Cone {field SFFloat bottomRadius 1field SFFloat height 2field SfBool side TRUEfield SFBool bottom TRUE

}

The Cone node specifies a cone centered in the local coordinatesystem and whose axis is aligned with the local y axis.The Boolean fields define whether the sides or bottomof the cone are visible. All dimensions are in meters.

Page 22: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

2204/20/23 18:02

UML

VRML 2.0Box Definition

Box {field SFVec3f size 2 2 2

}

The Box node specifies a rectangular box in the local coordinatesystem centered at 0,0,0 and aligned with coordinate axes.

Page 23: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

2304/20/23 18:02

UML

VRML 2.0Cylinder Definition

Cylinder {field SFBool bottom TRUEfield SFFloat height 2field SFFloat radius 1field SFBool side TRUEfield SFBool top TRUE

}

Sphere Definition

Sphere {field SFFloat radius 1

}

Page 24: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

2404/20/23 18:02

UML

VRML 2.0Indexed Face Set - Partial Definition

IndexedFaceSet {exposedField SFNode coord NULLfield SFBool ccw TRUEfield SFBool convex TRUE

field MFInt32 coordIndex []field SFBool solid TRUE...

}

Coordinate {exposedField MFVec3f point []}

There are 13 other fields in IndexedFaceSet, making it themost complex and flexible node in VRML.

Page 25: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

2504/20/23 18:02

UML

VRML 2.0Simplest Possible World

Shape{geometry Cone { }

}

Shape Node GeometryField

Cone node hasno fields: acceptall default values.

Shape node has no appearancefield: accept all white.

Page 26: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

2604/20/23 18:02

UML

VRML 2.0Appearance & Material Nodes

Appearance {exposedField SFNode material NULLexposedField SFNode texture NULLexposedField SFNode textureTransform NULL

}

Material {exposedField SFFloat ambientIntensity 0.2exposedField SFColor diffuseColor 0.8 0.8 0.8exposedField SFColor emissiveColor 0 0 0 exposedField SFFloat shininess 0.2exposedField SFColor specularColor 0 0 0exposedField SFFloat transparency 0

}

Page 27: 111/16/2015 07:14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates

2704/20/23 18:02

UML

VRML 2.0Transform Node Definition

Transform {enventIn MFNode addChildreneventIn MFNode removeChildren exposedField SFVec3f center 0 0 0exposedField MFNode children []exposedField SFRotation rotation 0 0 1 0exposedField SFVec3f scale 1 1 1exposedField SFRotation scaleOrientation 0 0 1 0exposedField SFVec3f translation 0 0 0field SFVec3f bboxCenter 0 0 0field SFVec3f bboxSize -1 -1 -1

}

Order of application:

T(translation) • T(rotation) • T(scale) {children}