APPENDIX A
Vectors
CONTENTS
A.1 Scaling a vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
A.2 Unit or Direction vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
A.3 Vector addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
A.4 Vector subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
A.5 Points and vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
A.6 Parametric definition of lines and rays . . . . . . . . . . . . . . . . . . . . . . . . 323
A.7 Dot or inner product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
A.7.1 Trigonometric interpretation of dot product . . . . . . . . . 324
A.7.2 Geometric interpretation of dot product . . . . . . . . . . . . . 324
A.7.3 Dot product example: The distance from a point to a
line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
A.7.4 Dot product example: Mirror reflection . . . . . . . . . . . . . . 325
A.8 Cross Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
A.8.1 Trigonometric interpretation of cross product . . . . . . . 326
A.8.2 Cross product example: Finding surface normals . . . . 327
A.8.3 Cross product example: Computing the area of a
triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
319
, 320 Foundations of Physically Based Modeling and Animation
To a mathematician, a vector is the fundamental element of what is known as a vector
space, supporting the operations of scaling, by elements known as scalars, and also
supporting addition between vectors. When using vectors to describe physical quantities,
like velocity, acceleration, and force, we can move away from this abstract definition, and
stick with a more concrete notion. We can view them as arrows in space, of a particular
length and denoting a particular direction, and we can think of the corresponding scalars
as simply the real numbers. Practically speaking, a vector is simply a way of simultaneously
storing and handling two pieces of information: a direction in space, and a magnitude or
length.
An arrow is a convenient way to draw a vector; since both length and
direction are clearly indicated. A real number is a convenient way
to represent a scalar, which when multiplied by a vector changes
its length. To the left are three visual representations of identical
vectors. They are identical, since they are all of the same length and
the same direction, i.e. they are parallel to each other. Their location
within the space is irrelevant.
In the study of physically based animation, we will initially be interested in vectors in two-
dimensional (2D) and in three-dimensional (3D) space, whose elements are real numbers.
But, we will see later that vectors can be defined in a space of any number of dimensions,
with elements that may themselves be multidimensional.
Notationally, a vector is usually denoted by a lower-case letter, which has a line over it,
like v, or is printed in bold type, like v. For hand written notes, the line is most convenient,
but in printed form the bold form is more usual. Throughout these notes the form v is
used.
A vector in 2D Euclidean space is defined by a pair of scalars arranged
in a column, like " #
v
v= x .
vy
Examining the diagram to the right, we see that vx denotes the v
vy
horizontal extent or component of the vector, and v y its vertical
component. Note, that in a computer program this structure can be
easily represented as a two-element array of floating point numbers,
vx
or a struct containing two floats. When working in 2D, the direction
of the vector can be given by the slope m = v y /vx . Its magnitude,
also called
q its norm, is written kvk. By the Pythagorean Theorem,
kvk = v2x + v2y .
A vector in 3D space is defined by three scalars arranged in a column,
vx
v = v y ,
vz
where vx is the horizontal component, v y the vertical component, and vz the depth
Vectors
CONTENTS
A.1 Scaling a vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
A.2 Unit or Direction vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
A.3 Vector addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
A.4 Vector subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
A.5 Points and vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
A.6 Parametric definition of lines and rays . . . . . . . . . . . . . . . . . . . . . . . . 323
A.7 Dot or inner product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
A.7.1 Trigonometric interpretation of dot product . . . . . . . . . 324
A.7.2 Geometric interpretation of dot product . . . . . . . . . . . . . 324
A.7.3 Dot product example: The distance from a point to a
line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
A.7.4 Dot product example: Mirror reflection . . . . . . . . . . . . . . 325
A.8 Cross Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
A.8.1 Trigonometric interpretation of cross product . . . . . . . 326
A.8.2 Cross product example: Finding surface normals . . . . 327
A.8.3 Cross product example: Computing the area of a
triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
319
, 320 Foundations of Physically Based Modeling and Animation
To a mathematician, a vector is the fundamental element of what is known as a vector
space, supporting the operations of scaling, by elements known as scalars, and also
supporting addition between vectors. When using vectors to describe physical quantities,
like velocity, acceleration, and force, we can move away from this abstract definition, and
stick with a more concrete notion. We can view them as arrows in space, of a particular
length and denoting a particular direction, and we can think of the corresponding scalars
as simply the real numbers. Practically speaking, a vector is simply a way of simultaneously
storing and handling two pieces of information: a direction in space, and a magnitude or
length.
An arrow is a convenient way to draw a vector; since both length and
direction are clearly indicated. A real number is a convenient way
to represent a scalar, which when multiplied by a vector changes
its length. To the left are three visual representations of identical
vectors. They are identical, since they are all of the same length and
the same direction, i.e. they are parallel to each other. Their location
within the space is irrelevant.
In the study of physically based animation, we will initially be interested in vectors in two-
dimensional (2D) and in three-dimensional (3D) space, whose elements are real numbers.
But, we will see later that vectors can be defined in a space of any number of dimensions,
with elements that may themselves be multidimensional.
Notationally, a vector is usually denoted by a lower-case letter, which has a line over it,
like v, or is printed in bold type, like v. For hand written notes, the line is most convenient,
but in printed form the bold form is more usual. Throughout these notes the form v is
used.
A vector in 2D Euclidean space is defined by a pair of scalars arranged
in a column, like " #
v
v= x .
vy
Examining the diagram to the right, we see that vx denotes the v
vy
horizontal extent or component of the vector, and v y its vertical
component. Note, that in a computer program this structure can be
easily represented as a two-element array of floating point numbers,
vx
or a struct containing two floats. When working in 2D, the direction
of the vector can be given by the slope m = v y /vx . Its magnitude,
also called
q its norm, is written kvk. By the Pythagorean Theorem,
kvk = v2x + v2y .
A vector in 3D space is defined by three scalars arranged in a column,
vx
v = v y ,
vz
where vx is the horizontal component, v y the vertical component, and vz the depth