Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 4731: Computer Graphics Lecture 6: Points, Scalars and Vectors Emmanuel Agu.

Similar presentations


Presentation on theme: "CS 4731: Computer Graphics Lecture 6: Points, Scalars and Vectors Emmanuel Agu."— Presentation transcript:

1 CS 4731: Computer Graphics Lecture 6: Points, Scalars and Vectors Emmanuel Agu

2 Points, Scalars and Vectors Points, vectors defined relative to a coordinate system

3 Vectors Magnitude Direction NO position Can be added, scaled, rotated CG vectors: 2, 3 or 4 dimensions Length Angle

4 Points Location in coordinate system Cannot add or scale Subtract 2 points = vector Point

5 Vector-Point Relationship Diff. b/w 2 points = vector v = Q – P Sum of point and vector = point v + P = Q P Q v

6 Vector Operations Define vectors and scalar, s Then vector addition: a a+b a

7 Vector Operations Scaling vector by a scalar Note vector subtraction: a b a-ba 2.5a

8 Vector Operations: Examples Scaling vector by a scalar For example, if a=(2,5,6) and b=(-2,7,1)and s=6, then Vector addition:

9 Affine Combination Summation of all components = 1 Convex affine = affine + no negative component

10 Magnitude of a Vector Magnitude of a Normalizing a vector (unit vector) Note magnitude of normalized vector = 1. i.e

11 Dot Product (Scalar product) Dot product, For example, if a=(2,3,1) and b=(0,4,-1) then

12 Dot Product Try your hands at these: ( 2, 2, 2, 2)( 4, 1, 2, 1.1) ( 2, 3, 1)( 0, 4, -1)

13 Dot Product Try your hands at these: ( 2, 2, 2, 2)( 4, 1, 2, 1.1) = 8 + 2 + 4 + 2.2 = 16.2 ( 2, 3, 1)( 0, 4, -1) = 0 + 12 –1 = 11

14 Properties of Dot Products Symmetry (or commutative): Linearity: Homogeneity: And

15 Angle Between Two Vectors c x b y Sign of b.c: b.c > 0 c b b b.c = 0 b c c b.c < 0

16 Angle Between Two Vectors Find the angle b/w the vectors b = (3,4) and c = (5,2)

17 Angle Between Two Vectors Find the angle b/w the vectors b = (3,4) and c = (5,2) |b|= 5, |c|= 5.385

18 Standard Unit Vectors Define So that any vector, y z x i j k 0

19 Cross Product (Vector product) If Then Remember using determinant Note: a x b is perpendicular to a and b

20 Cross Product Note: a x b is perpendicular to both a and b a x b a 0 b

21 Cross Product Calculate a x b if a = (3,0,2) and b = (4,1,8)

22 Cross Product Calculate a x b if a = (3,0,2) and b = (4,1,8) a x b = -2i – 16j + 3k

23 References Hill, chapter 4.2 - 4.4


Download ppt "CS 4731: Computer Graphics Lecture 6: Points, Scalars and Vectors Emmanuel Agu."

Similar presentations


Ads by Google