cse3431-lecture2.key
Vectors
n-tuple:
v 2 0 b · c = 0 b · c < 0
Perpendicular vectors
Definition
Vectors b and c are perpendicular iff b·c = 0
Also called normal or orthogonal
It is easy to see that the standard unit
vectors form an orthogonal basis:
i·j = 0, j·k = 0, i·k = 0
Cross product
Defined only for 3D Vectors and with respect
to the standard unit vectors
Definition
Properties of the cross product
1. i⇥ j = k, i⇥ j = k, i⇥ j = k.
2. Antisymmetry: a⇥ b = �b⇥ a.
3. Linearity: a⇥ (b+ c) = a⇥ b+ a⇥ c.
4. Homogeneity: (sa)⇥ b = s(a⇥ b).
5. The cross product is normal to both vectors:
(a⇥ b) · a = 0 and (a⇥ b) · b = 0.
6.|a⇥ b| = |a||b|sin(✓).
Geometric interpretation of the cross
product
Clarification for the figure:
a and b need not be perpendicular
Recap
Vector spaces
Operations with vectors
Representing vectors through a basis
v = a1b1+…anbn , vB = (a1,…,an)
Standard unit vectors
Dot product
Perpendicularity
Cross product
Normal to both vectors
Points vs Vectors
What is the difference?
Points vs Vectors
What is the difference?
Points have location but no size or direction.
Vectors have size and direction but no
location.
Problem: we represent both as triplets!
Relationship between points and
vectors
A difference between two points is a vector:
Q – P = v
We can consider a point as a point plus an
offset
Q = P + v
v
Q
P
Coordinate systems
Defined by: (a,b,c,θ)
The homogeneous representation of
points and vectors
Switching coordinates
Normal to homogeneous:
• Vector: append as fourth
coordinate 0
• Point: append as fourth
coordinate 1
Switching coordinates
Homogeneous to normal:
• Vector: remove fourth
coordinate (0)
• Point: remove fourth
coordinate (1)
Does the homogeneous
representation support operations?
Operations :
• v + w = (v1,v2,v3,0) +(w1,w2,w3,0)=
(v1+w1, v2+w2, v3+w3, 0) Vector!
• av = a(v1,v2,v3,0) = (av1, av2, av3, 0), Vector!
• av + bw = a(v1,v2,v3,0) +b(w1,w2,w3,0)=
(av1+bw1, av2+bw2, av3+bw3, 0) Vector!
• P+v = (p1,p2,p3,1) +(v1,v2,v3,0)=
= (p1+v1, p2+v2, p3+v3, 1) Point!
Linear combination of points
Points P, R scalars f,g:
fP+gR = f(p1,p2,p3,1) +g(r1,r2,r3,1)
= (fp1+gr1, fp2+gr2, fp3+gr3, f+g)
What is it?
Linear combination of points
Points P, R scalars f,g:
fP+gR = f(p1,p2,p3,1) +g(r1,r2,r3,1)
= (fp1+gr1, fp2+gr2, fp3+gr3, f+g)
What is it?
• If (f+g) = 0 then vector!
• If (f+g) = 1 then point!
Affine combinations of points
Definition:
Points Pi: i = 1,…,n
Scalars fi: i = 1,…,n
f1P1+ … + fnPn iff f1+ …+fn = 1
Example: 0.5P1 + 0.5P2
Geometric explanation
Recap
Vector spaces
Dot product
Cross product
Coordinate systems (mostly orthonormal)
Homogeneous representations of points and
vectors
Matrices
Rectangular arrangement of elements:
Special square matrices
Symmetric: (Aij )n x n= (Aji)n x n
Zero: Aij = 0, for all i,j
Iii = 1, for all i
Identity: In =
Iij = 0 for i ≠ j
Operations with matrices
Addition:
Properties:
Definition:
A few properties:
Matrix Multiplication
Cm⇥r = Am⇥nBn⇥r
(Cij) = (
nX
k
aikbkj)
1. Not commutative: AB 6= BA.
2. Associative: A(BC) = (AB)C.
3. Compatible with Scalar multiplication:
f(AB) = (fA)B and (AB)f = A(Bf).
4. Distributive:
A(B + C) = AB +AC, and (B + C)A = BA+ CA.
5. (AB)T = BTAT .
Inverse of a square matrix
Definition
MM-1 = M-1M = I
Important property (square matrices only)
(AB)-1= B-1 A-1
Convention
Vectors and points are represented as
column matrices
However, always keep track of the base, i.e.
the corresponding coordinate system
Dot product as a matrix
multiplication
A vector is a column matrix
Lines and Planes
Usually defined by an appropriate number of
points (vertices)
Lines
Line (in 2D)
• Explicit
• Implicit
• Parametric (extends to 3D)
Planes
Plane equations
Implicit
Parametric
Explicit
Exercises
Orthogonal projection of a vector on another
vector.
Orthogonal projection of a point on a plane.
Z-buffer Graphics Pipeline
Modeling
transformation
Viewing
transformation
Projection
transformation
Perspective
division
Viewport
transformation
OCS WCS VCS CCS
NDCS
DCS
Rasterization
Transformations (2D)
P
Q = T(P)
T
Why Transformations?
x
y
T
Affine Transformations (2D)
Linear in the coordinates
Matrix Form of Affine Transformations
Transformation as a matrix multiplication
Transforming Points and Vectors