Documente Academic
Documente Profesional
Documente Cultură
Finding Nemo © Disney/Pixar. The Lord of the Rings © New Line Productions, Inc. Geri’s Game © Pixar.
This Section’s Objectives
• Define
D fi b basic
i graphics
hi primitives
i iti
– Line segments
– Polygons
• Examples include v
– Force
– Velocity
– Directed
Di t d li
line segments
t
• Most important example for graphics
v -v 0.7v v w
• Operations
– Scalar-vector multiplication : u = αv
– Vector-vector addition : w = u+v
• Magnitude of a vector
– Calculate length with Pythagorean theorem
• Normalizing a vector
– Form a unit vector
α1 = α2 =…= αn = 0
⎢M⎥
⎢ ⎥
⎣α n ⎦
CSCI 3161- Computer Animation
Inner (Dot) Product
∑(u * v )
i =1
i i
C = uB ( A⋅ uB )
where
// the vectors
point2 vectorA = {0.0, 0.0};
point2 vectorB = {0.0, 0.0};
point2 vectorC = {0.0, 0.0};
// clear
l th
the projection
j ti matrix
t i
glLoadIdentity();
// setup
p the vectors
setupVectors();
// d
draw vector
t B green
…
glEnd();
glFlush();
lFl h()
}
• Vectors
Vecto s spaces are
a e insufficient
su c e t for
o constructing
co st uct g
geometric objects
– We need points too
v v= P-Q
Q
P = v+Q
• Operations
p
– Vector-vector addition
– Scalar-vector multiplication
– Scalar-scalar operations
– Point-vector addition
– Point-Point subtraction
P(α)
P0
P(-α)
P(α)
P0
P(1 0)
P(1.0)
v
P0
P
P
Q
Q
convex non-convex
non convex
• 3 sided polygon
interpolation of
P and Q
for 0 <= α <= 1 and 0 <= β <= 11, we get all points in triangle
interpolation of
S(α) and R
α, β
for 0 <= α <= 1 and 0 <= β <= 11, we get all points in triangle
R
n
P( β) = R + αm + βn
P(α, β
• Or equivalently by:
– three points (m = P-R and n = Q-R)
R Q
( β) = R + α(P-R)
P(α, (P R) + β(Q-R)
β(Q R)