Introduction to Vector
Lecturer: Kor Sokchea
Master of IT Engineering
Royal University of Phnom Penh
Semester I
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
1 / 36
Overview
Cartesian Coordinate Systems
Vectors
I
Mathematical Definition of Vector
Vector Notations
Geometric Definition of Vector
Specifying Vectors with Cartesian Coordinates
The Relationship between Points and Vectors
Negating a Vector
Vector Multiplication by a Scalar
Vector Addition & Subtraction
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
2 / 36
Cartesian Coordinate Systems
2D Coordinate Spaces
Consist of a special location
called the origin
Exist two straight lines that pass
through the origin
Two axes are perpendicular to
each other
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
3 / 36
Cartesian Coordinate Systems
Specify a point in 2D Cartesian
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
4 / 36
Cartesian Coordinate Systems
Example points labeled with 2D Catesian coordinates
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
5 / 36
Cartesian Coordinate Systems
3D Cartesian Space
Extend 2D into 3D by addin a
3rd axis
xy, xz, and yz planes
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
6 / 36
Cartesian Coordinate Systems
Specify a point in 3D Cartesian
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
7 / 36
Cartesian Coordinate Systems
Left-handed & Right-handed rule
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
8 / 36
Cartesian Coordinate Systems
Positive Rotation for Left-Right Hand
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
9 / 36
Vector
Mathematical Definition of Vector
Vectors are the formal mathematical entities we use to do 2D and 3D
math
Mathematically, a vector is nothing more than an array of numbers
The dimesion of a vector tells how many numbers the vector
contains
Vectors may be of any positive dimension (1D, 2D, 3D, 4D)
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
10 / 36
Vector
Vector Notations
There are two ways to write vector:
Column vector
x
y
z
Row vector
x y z
What is the different between them?
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
11 / 36
Vector
Vector Notations
In math, integer indices are used to access the elements of vector
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
12 / 36
Vector
Geometric Definition of Vector
The branch of mathematics that deals primarily with vectors and
matrices is called linear algebra
For 3D math, we are mostly concerned with the geometric
interpretations of vectors and vector operations
Geometrically speaking, a vector is a directed line segment that has
magnitude and direction
What is magnitude and direction?
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
13 / 36
Vector
Geometric Definition of Vector
The magnitude of a vector is the length of the vector
A vector may have any nonnegative length
direction of a vector describes which way the vector is pointing in
space
Where is this vector?
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
14 / 36
Vector
Geometric Definition of Vector
Vectors do not have position, only magnitude and direction
Sound Impossible?
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
15 / 36
Vector
Geometric Definition of Vector
Many quantities we deal with on a daily basis have magnitude and
direction
Vector Quantities
Displacement Take three step forward
Velocity I am traveling northeast at 50 mph
Scalar Quantities
Distance
Speed
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
16 / 36
Vector
Specifying Vectors with Cartesian Coordinates
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
17 / 36
Vector
The Zero Vector
There is a special vector, known as the zero vector for any given
vector dimension
The Zero Vector Notation
0
0
0=
....
....
0
The Zero vector consist of a magnitude of zero
The Zero vector has no direction
The Zero vector of a given dimesion is the additive identity for the
set of vectors of that dimension
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
18 / 36
Vector
The Relationship between Points and Vectors
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
19 / 36
Vector
Negating a Vector
The negation operation can be applied to vectors
Defintion
Every vector v has an additive inverse -v of the same dimension
such that:
v + (v) = 0
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
20 / 36
Vector
Negating a Vector
Official Linear Algebra Rules
To negate a vector of any dimension, we simply negate each
component of the vector as folows:
a1
a1
a2 a2
. .
. = .
an1 an1
an
Lecturer: Kor Sokchea
(RUPP)
an
Scientific Experience Seminar
Semester I
21 / 36
Vector
Negating Vector: Geometric Interpretation
Negating a vector results in a vector of the same magnitude but
opposite direction
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
22 / 36
Vector
Vector Multiplication by a Scalar
Official Linear Algebra Rules
a1
a2
k
. =
.
an1
an
Lecturer: Kor Sokchea
(RUPP)
ka1
a1
ka2
a2
.
.
. k = .
.
.
kan1
an1
kan
an
Scientific Experience Seminar
Semester I
23 / 36
Vector
Vector Multiplication by a Scalar
Example: Multiplying a 3D Vector by scalar
x
x
kx
k y = y k = ky
z
z
kz
Example: Dividing a 3D Vector by a nonzero scalar
vx /k
1
=
v = vy /k
k
k
vz /k
v
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
24 / 36
Vector
Vector Multiplication by a Scalar
Geometrically, multiplying a vector by a scalar K has the effect of
scaling the length by a factor of k
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
25 / 36
Vector
Vector Addition
Two vectors can be added if they are of the same dimension
Official Linear Algebra Rules
a1
b1
a1
a2
a2 b2
. .
. + . =
. .
an1
an1 bn1
an
an
bn
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
+ b1
+ b2
+ bn2
+ bn
Semester I
26 / 36
Vector
Vector Subtraction
Two vectors can be subtracted if they are of the same dimension
Official Linear Algebra Rules
b1
a1
b1
a1
a2 b2
a2 b2
. .
. .
. . = . + . =
. .
. .
an1 bn1
an1 bn1
bn
an
an
bn
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
a1 b1
a2 b2
an1 bn2
an bn
Semester I
27 / 36
Vector
Vection Addition & Subtraction: Geometric Interpretation
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
28 / 36
Vector
Adding Vector Example
Example
add the vectors a = (8,13) and b = (26,7)
c=a+b
c = (8,13) + (26,7) = (8+26,13+7) = (34,20)
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
29 / 36
Vector
Subtracting Vector Example
Reversing the vector we want to subtract by adding negative value,
then add
example
Subtract k = (6, 5) from v = (8, 3)
a=v+k
a = (8, 3) + (6, 5) = (8, 3) + (6,5) = (86,35) = (2,2)
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
30 / 36
Vector
Vector Magnitude (Length)
v
u n
q
uX
2
2
kvk = t
vi2 = v12 + v12 + ... + vn1
+ vn
i=1
Example
kvk =
kvk =
Lecturer: Kor Sokchea
(RUPP)
q
vx2 + vy2
(f or2Dvectorv)
q
vx2 + vy2 + vz2
(f or3Dvectorv)
Scientific Experience Seminar
Semester I
31 / 36
Vector
Unit Vector
A unit vectors or normalized vectors are a vector that has a
magnitude of one
Some vectors become shorter after normalization if their length was
greater than 1
Some vectors become longer after normalization if their length was
less than 1
v
v
=
kvk
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
32 / 36
Vector
Vector Dot Product
Official Linear Algebra Rules
b1
a1
a2 b2
... ...
... ... = a1 b1 + a2 b2 + ... + an1 bn1 + an bn
an1 bn1
bn
an
a.b=
n
X
ai bi
i=1
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
33 / 36
Vector
Vector Cross Product
Official Linear Algebra Rules
x1
x2
y1 z2 z1 y2
y1 y2 = z1 x2 x1 z2
z1
z2
x1 y2 y1 x2
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
34 / 36
Literature
Literature
1
Foley, J. D., Van Dam, A., Feiner, S.K., Hughes, J. F., &
Phillips R. L. (1996). Introduction to Computer Graphics.
Addison-Wesley
Watt A. H. (1990). Fundamentals of three-dimensional computer
graphics. Addison-Wesley.
Eberly D. H. (2001). 3D game engine design, a practical approach
to real-time computer graphics. Academic Press, Morgan Kaufmann.
Hughes, J. F., Van Dam, A., Foley, J. D., & Feiner, S. K.
(2013). Computer graphics: principles and practice. Pearson
Education.
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
35 / 36
Literature
Literature
1
Dunn, F., & Parberry, I. (2011). 3D math primer for graphics and
game development. CRC Press.
ARB, Dave Shreiner, editor,
I
OpenGL programming guide (RED)
OpenGL programming guide for the X-Windowsystem (GREEN)
OpenGL reference manual (BLUE) Addison-Wesley, 1999
Lecturer: Kor Sokchea
(RUPP)
Scientific Experience Seminar
Semester I
36 / 36