1 / 15

Computer Graphics

Explore 2D and 3D coordinate systems, points, vectors, linear interpolation, dot product, cross product in computer graphics. Learn about affine and linear combinations of vectors.

jamesgordon
Download Presentation

Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Graphics Chapter 5 Vector Based Algorithms

  2. 2D Coordinate Systems

  3. 3D Coordinate Systems Y Y Z X Z X Right-handed System Left-handed System

  4. 3D Coordinate Systems Right-handed System Left-handed System

  5. Points and Vectors Y Y v = (x,y) (x,y) (x,y) X X A point denotes a position in space. A vector is a directed line segment, having both magnitude and direction.

  6. Addition and Subtraction of Vectors Two vectors v1, v2 can be added to produce the diagonal vector v1+v2 according to the parallelogram rule. The result of vector subtraction produces v1v2 which is a vector directed from v2 to v1 .

  7. Linear Combination of Vectors Y X Z • A linear combination of vectors v1, v2 is given by • v = a v1+ b v2, • where a,b are constants. • A linear combination of vectors v1, v2 always lies • in the plane containing the vectors v1, v2. v1 v2 v = a v1+ b v2

  8. Affine Combination of Vectors Y X Z • An affine combination of vectors v1, v2 is given by • v = a v1+ b v2, • where a,b are constants, and a+b = 1. • In particular, v = (1t) v1+ t v2 is an affine • combination of vectors. v = (1-t)v1+ t v2 v1 v2

  9. Linear Interpolation of Vectors Y X Z The affine combination v = (1t) v1+ t v2 performs a linear interpolation between vectors v1 and v2 , if 0 t  1. v = (1-t)v1+ t v2 v1 v2

  10. Linear Interpolation of Vectors Example: A color (r,g,b) can be treated as a vector. If C1 = (r1, g1, b1) and C2 = (r2, g2, b2) are two colors then, a linear interpolation between the two colors is given by C = (1t) C1+ t C2 , 0 t  1. C1 C = (1t) C1+ t C2 C2

  11. Unit Vector • The magnitude of a vector v is denoted by |v|. • If v=(x,y,z), then |v|= • v/|v| is a unit vector.

  12. Vector Dot Product • The dot-product of two vectors v1 =(x1, y1, z1) and v2 =(x2, y2, z2) is v1.v2= x1x2 + y1y2 + z1z2. • The cosine of the angle  between two vectors v1, v2 is computed as follows: cos  = (v1.v2) / (|v1| |v2|). • In particular, when the vectors are orthogonal ( = 90 deg), then v1.v2 = 0

  13. Vector Cross Product • The cross-product of two vectors v1 =(x1, y1, z1) and v2 =(x2, y2, z2) is v1 x v2 = Also, v1 x v2 =

  14. Vector Cross Product The vector v1 v2 is orthogonal to both the vectors v1, and v2 . The three vectors v1, v2, v1 v2form a right-handed system. (Note that v1 and v2 are not necessarily orthogonal. Hence the right-handed system is not mutually orthogonal.)

  15. Planes • Any three non-collinear points P1, P2, P3 will define a unique plane. • Consider the vectors v1 = P2P1 , and v2 = P3P1. Both these vectors lie on the plane, and hence the vector n = v1 v2is normal to the plane.

More Related