Transcript 2-23-2005
Computer Graphics
Some Mathematics
CS 385
February 23, 2005
Vectors
• Many physical quantities such as temperature and speed
are measured with a single number. But other quantities
require more than one number. Examples include velocity
(which=speed + direction) and certain forces where the
strength and the direction are important.
• Vectors can be looked both algebraically and
geometrically.
• We will be using both representations
Vectors from the
Algebraic Point of View
• Vectors have a dimension
• A one dimensional vector is a real number
• A two dimensional vector is an ordered pair
of real numbers written (x, y).
• x and y are called the coordinates of the
vector.
• This can be generalized to any positive
integral dimension n
Vectors can be added
• Let’s think about 2 – dimensional vectors.
Let v = (v1,v2) and let w = (w1,w2) be two 2dimensional vectors.
Define v+w = (v1+w1, v2+w2)
We can do the same for 3-dimensional (or any
dimensional) vectors
(v1,v2,v3)+(w1,w2,w3) = (z1+z2+z3)=
(v1+w1+z1, v2+w2+z2, v3+w3+z3)
Sometimes we don’t care about the
coordinates of the vector and we just write
v+w = z
The idea here is to think of vectors as ordinary
numbers whenever possible. This way we
can use our intuition of numbers and apply
it to vectors. Of course not everything will
work. We need to be careful and check
things.
The zero vector
There is a special vector denoted 0 and called
the zero vector.
In 2 dimensions, 0 = (0,0).
Let’s note that 0 shares many of the same
properties of our good old regular number 0.
For any 2-dimensional vector v, we have,
v+0=0+v=v
The negative of a vector
Let v be a 2-dimensional vector.
Let us show that there exists a vector that
when added to v yields the 0 vector.
Define –v = (-v1,-v2)
Theorem: v + (-v) = 0
Proof:
v+(-v)=(v1,v2)+(-v1,-v2)=
(v1+(-v1),v2+(-v2))=(0,0) = 0
Scalars
Scalars can be thought of as ordinary real
numbers. In general they can be complex
numbers or any elements in an algebraic
structure called a field. But for our
purposes, the field is the ordinary real
numbers.
Scalars are often written as lower case greek
letters but I will use a, b, c, d, e, f, or a1.a2,
• The coordinates of a vector come from the
set of scalars.
• We can multiply a scalar by a vector by
multiplying it coordinatewise:
aV = a(v1,v2) = (av1,1v2)
Vectors from the
Geometric Point of View
• Geometrically a vector is an arrow
• It is characterized by two quantities, its
direction and its length. Its length is often
called its magnitude.
Important Consequence of
Definition of Vector from Geometric
point of view
Two vectors with the same length and same
direction are actually the same vector
Addition of Geometric Vectors
v+w
v
w
Addition of Geometric Vectors
v+w
v
w
v+w=?
Subtraction of Geometric Vectors
We define:
v-w to be v + (-w)
Example
v
v-w
w
Dot product between 2 vectors
v·w = v1w1 + v2w2
Notice: The dot product of 2 vectors is a
scalar.
Interesting Fact
If v·w=0 then v and w are perpindicular
Norm of a vector
||v||=
v12 v 2 2
The norm of a vector is its length
Bringing in a little trig
Some Formulas
cosθ =
uv
|| u |||| v ||
Next Time
Matrices and Transformations