Docsity

Trigonometry and Vector Algebra: Lecture Notes for Cap4720 Fall2008 - Prof. Juraj Obert, Exams of Computer Graphics

Partial preview of the text

Download Trigonometry and Vector Algebra: Lecture Notes for Cap4720 Fall2008 - Prof. Juraj Obert and more Exams Computer Graphics in PDF only on Docsity!

Juraj [email protected] http://graphics.cs.ucf.edu/cap4720/fall2008/

Trigonometry

 Angles: φ 2π−φ

Length of the arc of the unit circlethat is cut by two directions. Which arc?Convention: The arc swept out counterclockwise from the first lineto the second line. unit: Radian conversion: * degrees radians 180

degrees^180 *radians =^ ππ

=

Trigonometry

 Trigonometric functions:

h

b

h

in p

cos

s

φ

φ φ^ p b

h

Trigonometry

 Triangle Laws:

trianglearea 41 ( )( )( )( )

(Lawoftangents) tan 2

tan 2

2 cos (Lawofcosines)

sin sin sin (Lawofsines) 2 2 2

a b c a b c a b c a b c

A B

A B a b

a b

c a b ab C

c

C b

B a

A

= + + − + + − + + −

^ − 

= ^ +^  −

= + −

= =

c b

a C (^) A

B

Geometric Primitives

 Polygons  circular sequence (cycle) of points (vertices) and segments (edges)

Some Geometric Problems

Segment intersection: Given two segments, do they intersect

Inclusion in polygon: Is a point inside or outside a polygon?

Simple closed path: intersecting polygon with vertices on the points. given a set of points, find a non-

Segment Intersection

 Test whether segments (a,b) and (c,d) intersect. How do we do it? a

c b

d

Point Inclusion

 given a polygon and a point  is the point inside? or  outside the polygon?

Vector

 Magnitude? Q' = (x 1 - x, y 1 - y, z 1 - z) | V | = √√√√(( x 1 -x )^2 + ( y 1 -y )^2 + ( z 1 - z )^2 )

Z^ X

Y

P

V Q Q'

Unit vector : | V |=

aV

Vector Algebra

 Scalar Multiplication : for V = (V a V = x^ , V (aVy^ , Vx , aVz)y , aVz)

V How to make a Unit Vector?

V

V '= V

Vector Algebra

 Vector addition: V 1 +^ V 2 = ( V1x +^ V2x , V1y +^ V2y , V1z +^ V2z )

V 1

V 2 V^1

+ V^2

Vector Algebra

 Scalar Product (dot product): V 1 • V 2 = | = V V 1x 1 | |. V V (^2) 2x | cos + V^ 1y θθθθ. V2y + V1z. V2z

V (^2) θ V 1

Vector Algebra

 Vector product ( V cross product ): 1 ××××^ V 2 = (V1y.V2z - V1z.V2y , V1z.V2x - V1x.V2z , V1x.V2y - V1y.V2x)

x y z

x y z

V V V

V V V

i j k

2 2 2

1 1 1

Magnitude of the vector is the area of the shaded region.

Vector Algebra

 Cross product is a Vector.  Right-hand rule determines the direction of the productvector

V (^2) V 1

V^1 ××××^ V^2 θ

Basis Vectors

 A set of axis vectors is called a basis.

Z^ X

Y

Ortho-normal Basis

 normal basis : A basis with unit axis vectors.  orthogonal basis perpendicular axis vectors. : A basis with mutually  Ortho-normal basis mutually perpendicular axis vectors. : A basis with unit and  orthonormal basis for a 3D cartesian co-ordinatesystem is: i = (1,0,0), j = (0,1,0), k = (0,0,1)

Matrix

 Matrix is a rectangular array of numbers. example: a 4×3 matrix

41 42 43

31 32 33

21 22 23

11 12 13

a a a

a a a

a a a

a a a

:represents column.

:representsrowand

: theelementsofthematrix, j

i

aij

Special Matrices

 Square Matrix:

of rows = # of columns

 Row Matrix:  a single rows of elements  Column Matrix:  a single column of elements

[ 1 − 3 1 ]

Special Matrices

 Diagonal Matrix  a square matrix with all except diagonals are 0i.e. a ij = 0 if^ i^ ≠^ j.

44

33

22

11

0 0 0

a

a

a

a

Diagonal Matrix

 Identity Matrix  All diagonal elements are 1.  denoted by symbol I  example:



×^ =
I 33

Matrix Arithmatic

 Multiplication (or product) of matrices:  possible only if  # columns in 1st^ matrix = # rows in 2nd^ matrix.  i.e. if A is a m × n matrix and B is n × p matrix  then matrices are conformable for multiplicationand the product matrix C is a m × p matrix

Product of Matrices

 The elements of the product of two matrices A and B:

cij = ∑ k aikbkj

3111 32 21 3112 32 22

2111 22 21 2112 22 22

1111 12 21 1112 12 22 21 22

11 12 31 32

21 22

11 12

example :

a b a b a b a b

a b a b a b a b

a b a b a b a b b b

b b a a

a a

a a

Product of Matrices

 example:

Scalar product of vectors A and B:^ ∑

cij = (^) k aikbkj

[ ] [ ]

[ ] 112233

3

2

1 1 2 3

ab ab a b b

b

b A B AB a a a

A a a a B b b b

T (^) = + + 

Product of Matrices

example:

Vector Product of vectors A and B:^ ∑

cij = (^) k aikbkj

[ ] [ ]

[ 2 3 3 2 3 1 1 3 1 2 2 1 ]

3

2

1 2 1

3 1

3 2

1 2 3 1 2 3

ab ab ab ab ab a b

b

b

b a a

a a

a a A B

A a a a B b b b

× =