1 / 96

COS 397 Computer Graphics

COS 397 Computer Graphics. Svetla Boytcheva AUBG, Spring 2013. Lecture 2 Ray Tracing & Transformations. Outline. Points and Vectors Matrices Vector Operations Ray Tracing Homogenous coordinates Affine Transformations Translation Rotation Scaling Projection View Point

miller
Télécharger la présentation

COS 397 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. COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013

  2. Lecture 2Ray Tracing & Transformations

  3. Outline • Points and Vectors • Matrices • Vector Operations • Ray Tracing • Homogenous coordinates • Affine Transformations • Translation • Rotation • Scaling • Projection • View Point • Coordinates of objects on the surface of other objects

  4. Points and Vectors

  5. Points and Vectors • Drawing systems of particles • Determining coordinates of other objects • Drawing objects

  6. Points and Vectors • Points • (x,y,z) • Representation • Absolute coordinates (point) • Relative coordinate (radius-vector) • Distance (vector) • Direction (vector)

  7. Points in 3D • 3D absolute coordinates X P(x,y,z) x y Y z Z

  8. Radius-vector • Relative coordinate (radius-vector) (0,0,0) X x P(x,y,z) y Y z Z

  9. Length and Magnitude • Calculating the length/magnitude • Requires reference point R |p| X R Y z  x  y Z

  10. Direction • Determines the direction in 3D • This is not sufficient for complete orientation X |p| Y Z

  11. Points and Vectors operations

  12. Vectors representation • Vectors (points) • Vector defined by points X1and X2

  13. Examples • Vector p(5,2,3) • Vectorq from point (3,0,8) to (0,2,7)

  14. P2 y2 V y1 P1 x1 x2 Points and Vectors • Point • Vector: Pointposition and direction • Magnitude- Direction

  15. Length • Vector p length • Unit vector • Vector with length=1

  16. Examples • Vectorp(5,2,3) • Vectorp from (3,0,8) to (0,2,7)

  17. Addition and Subtraction • Vector can be added or subtracted only to other vector

  18. Examples • Addition of p(5,2,3) andq(-1,-1,1) • Subtraction of q(-1,-1,1) and r(4,1,4)

  19. Product • Various product operations • Product with scalar (i.e. vector and number) • Scalar product of vectors • Vector product of vectors • Three of them are used in Computer Graphics for important operations

  20. Product with scalar • Product with number • Geometrical meaning • Scaling (extending, shortening) vector • Preserves the direction for k>0 • Reverses direction when k<0 (the opposite direction)

  21. Examples • Doubled vector p(5,2,3) • Reversed vector q(-1,-1,1)

  22. Unit Vector • Unit vector • Geometrical meaning • Vector with length = 1 • Preserves the direction • Can be applied only over non-zero vectors

  23. Examples • Unit vector of p(5,2,3) • Check

  24. Scalar Product • Product of two vectors, the result is scalar (number) • Angle between two vectors • Geometrical/Graphical meaning • Checking for perpendicularity • Lightening of surface • Calculating the area

  25. p.q calculating • Using unit axis vectors X p Y ey ex ez Z

  26. Multiply Remember that Find

  27. Examples (2,2,0).(0,1,0) • Lucky method • Lying in the same plane • Angle between = 45о • First class method • "First class" in terms of quality • but also because it may be applied by first grader student

  28. Example • Check whether the vectors are perpendicular • p(4,0,1)and q(-2,3,8) • Solution

  29. V2  V1 |V2|cos Scalar Product • Definition • For Cartesian Reference Frame • Properties • Commutative • Distributive Dot Product, Inner Product

  30. Vector product • Vector product and the result is vector • Anglebetween two vectors • Geometrical meaning • Finding normal vectors • Parallelogram Area

  31. V1 V2 V2 u  V1 Where vector points on? • The Result vector of Vector product is: • Perpendicular to the plane defined by to vector in this product • Lies in the plane where the direction of rotation from the first to the second vector is positive (i. e. counterclockwise)

  32. How to remember? • Use right hand • Coordinate system PQRis right-hand Снимка: FreeDigitalPhotos.net

  33. Unit Vectors X X + - + - Z Z Y Y ey ey ex ex ez ez + -

  34. Calculation of pхq • Using unit axis vectors

  35. After vector product of unit vectors Regroup

  36. Final Result

  37. V1 V2 V2 u  V1 Vector Product Cross Product, Outer Product • Definition • For Cartesian Reference Frame • Properties • AntiCommutative • Not Associative • Distributive

  38. Scalar Product Vector Product Examples (x2,y2) V2  (x1,y1) V1 (x0,y0) Angle between Two Edges Normal Vector of the Plane

  39. Determinant of Matrix • Definition • For a square matrix, combining the matrix elements to product a single number • 2  2 matrix • Determinant of nn Matrix A (n 2)

  40. Inverse Matrix • Definition • Non-singular matrix • If and only if the determinant of the matrix is non-zero • 2  2 matrix • Properties

  41. 2D Geometric Transformations

  42. Geometric Transformation • Definition • Translation, Rotation, Scaling • Motivation – Why do we need geometric transformations in CG? • As a viewing aid • As a modeling tool • As an image manipulation tool

  43. Example: 2D Geometric Transformation Modeling Coordinates World Coordinates

  44. Example: 2D Scaling Modeling Coordinates Scale(0.3, 0.3) World Coordinates

  45. Example: 2D Rotation Modeling Coordinates Scale(0.3, 0.3) Rotate(-90) World Coordinates

  46. Example: 2D Translation Modeling Coordinates Scale(0.3, 0.3) Rotate(-90) Translate(5, 3) World Coordinates

  47. Example: 2D Geometric Transformation Modeling Coordinates Again? World Coordinates

  48. Example: 2D Geometric Transformation Modeling Coordinates Scale Translate Scale Rotate Translate World Coordinates

  49. Basic 2D Transformations • Translation • Scale • Rotation • Shear

  50. Basic 2D Transformations • Translation • Scale • Rotation • Shear Transformations can be combined (with simple algebra)

More Related