Conventions - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

Conventions

Description:

Each vector is defined with respect to a set of basis vectors (which define a co ... the parallelogram law in 2D and the parallelepiped law in higher dimensions: ... – PowerPoint PPT presentation

Number of Views:54
Avg rating:3.0/5.0
Slides: 33
Provided by: drste95
Category:

less

Transcript and Presenter's Notes

Title: Conventions


1
Conventions
  • Vector quantities denoted as v or
  • We will use column format vectors
  • Each vector is defined with respect to a set of
    basis vectors (which define a co-ordinate
    system).
  • Basis vectors not necessarily mutually
    orthogonal.

2
Row vs. Column Formats
  • Both formats, though appearing equivalent, are in
    fact fundamentally different
  • be wary of different formats used in textbooks

row format
column format
transposed
3
Vectors Points
  • Although vectors and points are often used
    inter-changeably in graphics texts, it is
    important to distinguish between them.
  • vectors represent directions
  • points represent positions
  • Both are meaningless without reference to a
    coordinate system
  • vectors require a set of basis vectors
  • points require an origin and a vector space

both vectors equal
4
Vector Addition Subtraction
  • Addition of vectors follows the parallelogram law
    in 2D and the parallelepiped law in higher
    dimensions
  • Subtraction

5
Vector Multiplication by a Scalar
  • Each vector has an associated length
  • Multiplication by a scalar scales the vectors
    length appropriately (but does not affect
    direction)

6
Linear Combinations
  • The linear combination of a set of vectors is the
    sum of scalar multiples of those vectors
  • Fixing vectors vi yields an infinite number of u
    depending on the scalars ai.
  • The set u is called the span of the vectors vi
  • The vectors vi are term basis vectors for the
    space.
  • If none of the vi can be created as a linear
    combination of the others, the vectors vi are
    said to be linearly independent.
  • All linear combinations contain the zero vector.

7
Linear Combinations
  • Linear combinations of 1 vector an infinite
    line

8
Linear Combinations
  • Linear combinations of 2 vectors a plane

9
Linear Combinations
  • The linear combination of 3 vectors a 3D
    volume.
  • The 3D Cartesian coordinate system employs the
    well-known 3D co-ordinate basis x, y and z

The vector v here is a linear combination of the
basis vectors x, y and z
10
Vector Magnitude
  • The magnitude or norm of a vector of dimension n
    is given by the standard Euclidean distance
    metric
  • For example
  • Vectors of length 1 (unit vectors) are often
    termed normal vectors.

11
Normal Vectors
  • When we wish to describe direction we use
    normalised vectors.
  • We often need to normalise a vector

12
Dot Product
  • Dot product (inner product) is defined as
  • Note
  • Therefore we can redefine magnitude in terms of
    the dot-product operator
  • Dot product operator is commutative and
    associative.

13
Dot Product
  • If one of the vectors is normal, the dot product
    defines the projection of the other onto it
    (perpendicularly)
  • In this example, a is positive and b is negative.
  • Note that if both vectors are pointing in same
    direction, the dot-product is positive.

q
14
Dot Product
  • If both vectors are normal, the dot product
    defines the cosine of the angle between the
    vectors

In general
15
Dot Product
  • Note that is q 90 then the dot product 0,
    i.e. the projection of one onto the other has
    zero length ? vectors are orthogonal.
  • Also, if q gt 90 then the dot product is negative.
  • Example

16
Cross Product
  • Used for defining orientation and constructing
    co-ordinate axes.
  • Cross product defined as
  • The result is a vector, perpendicular to the
    plane defined by u and v

17
Cross Product
Right Handed Coordinate System
18
Cross Product
  • Cross product is anti-commutative
  • It is not associative
  • Direction of resulting vector defined by operand
    order

R.H.S.
19
Normals Polygons
  • Polygons are (usually) planar regions bounded by
    n edges connecting n1 points or vertices.
  • For lighting and viewing calculations we need to
    define the normal to a polygon
  • The normal distinguishes the front-face from the
    back-face of the polygon.

v1
e3
e1
v3
e2
v2
20
Normals Polygons
  • First determine the 2 edge vectors from the
    vertices
  • The polygon normal is given by

u2
v1
u1
v3
v2
21
Homogeneous Co-ordinates
  • Basis of the homogeneous co-ordinate system is
    the set of n basis vectors and the origin
    position
  • All points and vectors are therefore compactly
    represented using their ordinates

22
Homogeneous Co-ordinates
  • Vectors have no positional information and are
    represented using ao 0 whereas points are
    represented with ao 1
  • Examples

Points
Associated vectors
23
Hierarchical Transformations
  • For geometries with an implicit hierarchy we wish
    to associate local frames with sub-objects in the
    assembly.
  • Parent-child frames are related via a
    transformation.
  • Transformation linkage is described by a tree
  • Each node has its own local co-ordinate system.

24
Hierarchical Transformations
R
R
R
T
Hierarchical transformation allow independent
control over sub-parts of an assembly
25
translate base
rotate joint1
rotate joint2
complex hierarchical transformation
26
OpenGL Implementation
glMatrixMode(GL_MODELVIEW) glLoadIdentity() glTr
anslatef(bx, by, bz) create_base() glTranslat
ef(0, j1y, 0) glRotatef(joint1_orientation)
create_joint1() glTranslatef(0, uay, 0)
create_upperarm() glTranslatef(0,
j2y) glRotatef(joint2_orientation)
create_joint2() glTranslatef(0, lay, 0)
create_lowerarm() glTranslatef(0, py,
0) glRotatef(pointer_orientation)
create_pointer()
27
Hierarchical Transformations
  • The previous example had simple one-to-one
    parent-child linkages.
  • In general there may be many child frames derived
    from a single parent frame.
  • we need some mechanism to remember the parent
    frame and return to it when creating new
    children.
  • OpenGL provide a matrix stack for just this
    purpose
  • glPushMatrix() saves the CTM
  • glPopMatrix() returns to the last saved CTM

28
Hierarchical Transformations
Each finger is a child of the parent (wrist) ?
independent control over the orientation of the
fingers relative to the wrist
29
Hierarchical Transformations
30
glMatrixMode(GL_MODELVIEW) glLoadIdentity() glTr
anslatef(bx, by, bz) create_base() glTranslat
ef(0, jy, 0) glRotatef(joint1_orientation)
create_joint1() glTranslatef(0, ay, 0)
create_upperarm() glTranslatef(0,
wy) glRotatef(wrist_orientation)
create_wrist() glPushMatrix() // save frame
glTranslatef(-xf, fy0, 0) glRotatef(lowerfinge
r1_orientation) glTranslatef(0, fy1, 0)
create_lowerfinger1() glTranslatef(0, fy2,
0) glRotatef(upperfinger1_orientation)
create_fingerjoint1() glTranslatef(0, fy3,
0) create_upperfinger1() glPopMatrix() //
restore frame glPushMatrix() // do finger
2... glPopMatrix() glPushMatrix() // do
finger 3... glPopMatrix()
Finger1
31
Project2 part 1
  • Hierarchical Transformations
  • Demonstrate the use of hierarchical coordinate
    transforms in computer graphics. Create a small
    OpenGL program which implements a hierarchical
    transformation. Examples are
  • (1) A small planetary system
  • Sun at the center rotates about origin
  • planet1 revolves about the sun in an orbit of
    radius d1 and rotates about it's centre. Orbit
    lies on a plane tilted at an angle theta1
  • planet2 revolves about the sun in an orbit of
    radius d2 and rotates about it's centre. Orbit
    lies on a plane tilted at an angle theta2
  • satelite revolves about planet 2 at an orbit of
    radius d3 and rotates about it's centre.

32
  • (2) A robotic claw
  • wrist is a fixed vertically cylinder connected to
    origin
  • palm (or knuckle) is a fixed horizontal cylinder
    connected to wrist
  • finger_bone1a is a free cylinder and is connected
    to palm and swings about axis of the palm
  • finger_bone1b is connected to finger_bone1a and
    swings about axis at end of the finger_bone1a
  • finger_bone2a is a free cylinder and is connected
    to palm and swings about axis of the palm
  • finger_bone2b is connected to finger_bone2a and
    swings about axis at end of the finger_bone2a
  • or any decent example which demonstrates
    hierarchical transforms with a hierarchy of at
    least two branches and a 3 levels deep
Write a Comment
User Comments (0)
About PowerShow.com