Geometric Objects and Transformations - PowerPoint PPT Presentation

geometric objects and transformations n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Geometric Objects and Transformations PowerPoint Presentation
Download Presentation
Geometric Objects and Transformations

play fullscreen
1 / 103
Geometric Objects and Transformations
181 Views
Download Presentation
gusty
Download Presentation

Geometric Objects and Transformations

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Geometric Objects and Transformations Coordinate systems and frames Working with representation Object transformation Suriyong L.

  2. Introduction • Mathematical of Object • Euclidean vector spaces • Vector space with measure of size • Independent of coordinate system • Parametric form system Suriyong L.

  3. Scalars, Points, and Vectors • Geometric object description in space • By length, angle • With 3 fundamental types scalars, points and vector Suriyong L.

  4. The geometric View • Point : a location in the space • Mathematical for point • Neither a size nor shape • Properties • location • What for : • Specify an object Suriyong L.

  5. Scalars • Quantity of object or relation objects • Ex. Distance between object • Specify with real / complex number • Useful rule for scalar • communitivity and Associativity in multiplicity, additivity • Ex. a+b = b+a, (a+b)+c = a+(b+c) Suriyong L.

  6. Directed line segment that connects points Identical vectors Vector • Quantity with direction and magnitude ex. velocity, force • Does not have a fixed position in space • Synonymously to line segment • Computer graphics often connect points with directed line segment • Line segment: a segment of line which has both magnitude and direction Suriyong L.

  7. Parallel line segments Addition of line segments Inverse vectors Vector properties • Its lengths changed by real number • B = 2A • B is double in size to vector A with the same direction • Vector combining: (addition) • Use head to tail combining, the result is the sum of the vector • Any vector in space is able to do addition, independent of its location • Scalar-vector addition make sense: ex. A + 2B – 3C • Inverse vector: • The vector that has opposite direction to the original vector Suriyong L.

  8. Point-vector addition Vector operation • Scalar multiplying • Result change in length (magnitude) • Point-vector addition • Result change in displacement to the new point position • Point-point subtraction • Result is a vector between 2 points • Note: Some expression involving scalars, vectors and points make sense ex. P+3v, or P-2Q+3v while P+3Q-v do not Suriyong L.

  9. Object and coordinate system Coordinate-free geometry • For graphics system let the object relate to each other but independent of coordinate system • Let object relate to an arbitrary location and orientation of the original axis Object without coordinate system Suriyong L.

  10. The mathematical view: Vector and Affine Spaces • Scalar operation • Addition , multiplication • If operation obey closure, associativity, commutivity and inverse properties, the element form a scalar field • Ex. field . Real number, complex number, rational function Suriyong L.

  11. Vector space • 2 distinct type of entities in vector space • Scalar and vector • Scalar-vector multiplication • Vector and vector • Vector – vector addition • Euclidean space • Extension of vector space • Add a measure of size or distance to define object • Ex. Length of line segment Suriyong L.

  12. Affine space (space of transformation) • Extension of vector space • Include point to vector space • Have vector-point addition and point-point operation Suriyong L.

  13. Computer Science View • Prefer to see object as abstract data type (ADT) • Operations and data are defined independently • Fundamental to modern computer science • Like C++ language features : class and overloading vector u,v; point p,q; scalar a, b; Computational point of view declaration (Independent of data type declaration) q = p+a*v; Operation that independent of data type Suriyong L.

  14. Geometric ADT • Learn how to perform geometric operation and forming geometric object • Let Greek letter a, b, g,... : scalars Upper-case letter P, Q, R,… : points Bold lower-case letters u, v, w,… : vector Suriyong L.

  15. Point-point subtraction Use of the head-to-tail rule (a) For vectors, (b)For points • The operation of vector-scalar multiplication • Subtraction of two points, P and Q -> vectorv • Add vector with point get point • Vector-vector operation can be in point form Suriyong L.

  16. Lines • General term definition • Called parametric form of line • Point generating by varying alpha • Line is infinity in length • One we see just line segment Parametric line equation Line in an affine space Suriyong L.

  17. Affine sum If P is a point on line P=Q+av v = R – Q; Thus P = Q + a(R-Q) = aR + (1-a)Q Let a = a1 and (1-a) = a2 Thus a1 + a2 = 1 Then P=a1R+a2Q Points on line can be found between point Q and P(a) Affine line addition Suriyong L.

  18. Line segment that connects two points Convexity • Convex object • Any point that lying on line segment connect any two points in the object also in the object • Affine sum definition Objects defined by n points P1, P2,…,Pn. Consider the form When Suriyong L.

  19. Convexity • An object is convexiff for any two points in the object all points on the line segment between these points are also in the object P P Q Q not convex convex Suriyong L.

  20. Convex hull Convex hull The set of points formed by the affine sum of n points, under the additional restriction is called the convex hull of the set of points convex hull includes all line segments connecting pairs of points i[P1,P2,…,Pn] The notion of convexity is extreamly important in the design of curves and surfaces; Suriyong L.

  21. Dot product and projection Dot and Cross product • Dot (inner product) • u.v: result is magnitude of 2 vectors • If u.v = 0, u and v are orthogonal vector • Unit product is Suriyong L.

  22. Cross product Cross product • Result is vector • Forming from right hand coordinate system Note:right-handed coordinate system u points in the direction of the thumb v points in the direction of the index finger n points in the direction of the middle finger Suriyong L.

  23. Plane • Infinite flat area • Direct extension of parametric line • Define with 3 non-co-linear points • Suppose P, Q and R are points in plane • The plane equation and Suriyong L.

  24. General plane equation The plane can have vector(normal vector) formed from u and v Let n :plane vector Thus Suriyong L.

  25. Curves in three dimension Surfaces in three dimensions Volumetric objects 3D primitives Object are not lying on plane Suriyong L.

  26. 2 problems when incorporate in 3D • Complex mathematic • Not all object that has 3D efficient implementation • Approximated method may be used • 3 features characteristic to describe object • Hollow • Vertices • Flat convex polygon composition Suriyong L.

  27. Coordinate system and frame • Represents Vector in 3D space with 3 basis vector thus Vector derived from three basis vectors Suriyong L.

  28. Coordinate system (a) with vector emerging from a common point, (b) with vector moved A Dangerous representation of vector Point and vector representation in affine space • It is not enough to use only vector to represent point in space • Frame: fix point (origin) and basis vector • Vector: represent with 3 basis • Point: fix point and 3 basis Suriyong L.

  29. Representations and N-tuples • Any vector v representation Where • In column matrix form • Known as Euclidean : Suriyong L.

  30. Coordinate System Changing World /User frame Camera frame • Done by MODELVIEW matrix • Use 2 basis set of vector and • Representation of by Let and represent matrix from to Suriyong L.

  31. Let Equivalent to Where Assume : the representation of with respect to or Where Then using our representation of the second basis in terms of the first, we find that Thus The matrix (MT)-1 takes us from a to b: We can transfer coefficient matrix from one to the other Suriyong L.

  32. Translation of a basis Rotation and scaling of a basis • This changing let us to work with different coordinate system but origin unchanged • Able to use them to represent rotation and scaling but not translation 2 examples 2 different frames Suriyong L.

  33. Example: Suriyong L.

  34. The matrix that converts a representation in , and to one in which the basis vector areand is In the new system, the representation of w is That is Suriyong L.

  35. Homogeneous Coordinate 3 basis vector is not enough to make point and vector different For any point: In the frame specified by (v1, v2, v3, P0), any point P can be written uniquely as The we can express this relation formally, using a matrix product, as The yellow matrix called homogeneous-coordinate representationof point P Suriyong L.

  36. In the same frame, any vector w can be written wcan be represented by the column matrix If and ,can be expressed as Suriyong L.

  37. Can be written in the form M : the matrix representation of the change of frames. Suppose a and b are the homogeneous-coordinate representations, then Hence, Suriyong L.

  38. When we work with representations, as is usually the case, we are interested in , which is of the form Only 12 coefficients • Advantage of using homogeneous representation • use 4D matrix instead of 3D matrix • less calculation • modern hardware support the representation • parallelism for high speed calculation Suriyong L.

  39. Example Suriyong L.

  40. Suppose move the point to (1, 2, 3, 1) with displacement vector And move from point P0 to Q0 then The matrix becomes Its inverse is We can move back and forth between representation Thus to Suriyong L.

  41. The origin in the new system is represented as Original vector is transformed to <- b= (MT)-1a Suriyong L.

  42. Working with Representation • Represent object from a frame to another such as world frame to camera frame • Form of representation a = Cb ; a, b object in two representation frame • Object: • 3 vector, u, v, n, and 1 new frame origin, p -> (u, v, n, p) • 4 entities -> 4-tuples -> R4 • The solution is inverse matrix form of C, let’s say D D = C-1 Suriyong L.

  43. Suriyong L.

  44. Frames in OpenGL • 2 frames: • Camera: regard as fix • World: • The model-view matrix position related to camera • Convert homogeneous coordinates representation of object to camera frame • OpenGL provided matrix stack for store model view matrices or frames • By default camera and world have the same origin • If moving world frame distance d from camera the model-view matrix would be Suriyong L.

  45. Camera and world frames Suriyong L.

  46. Suppose camera at point (1, 0, 1, 1) • World frame center point of camera • Representation of world frame for camera • Camera orientation: up or down • Forming orthogonal product for determining v let’s say u Camera at (1,0,1) pointing toward the origin Suriyong L.

  47. The model view matrix M Result: Original origin is 1 unit in the n direction from the origin in the camera frame which is the point (0, 0, 1, 1) OpenGL model view matrix OpenGL set a model-view matrix by send an array of 16 elements to glLoadMatrix We use this for transformation like rotation, translation and scales etc. Suriyong L.

  48. One frame of cube animation Modeling a Color Cube • A number of distinct task that we must perform to generate the image • Modeling • Converting to the camera frame • Clipping • Projecting • Removing hidden surfaces • Rasterizing Suriyong L.

  49. Modeling a Cube • Model as 6 planes intersection or six polygons as cube facets • Ex. of cube definition GLfloat vertices[8][3] = { {-1.0,-1.0,-1.0}, {1.0,-1.0,-1.0}, {1.0,1.0,-1.0}, {-1.0,1.0,-1.0}, {-1.0,-1.0,1.0}, {1.0,-1.0,1.0}, {1.0,1.0,1.0}, {-1.0,1.0,1.0} }; // object may defined as void polygon(int a, int b, int c , int d) { /* draw a polygon via list of vertices */ glBegin(GL_POLYGON); glVertex3fv(vertices[a]); glVertex3fv(vertices[b]); glVertex3fv(vertices[c]); glVertex3fv(vertices[d]); glEnd(); } // or typedef point3[3]; // then may define as point3 vertices[8] = { {-1.0,-1.0,-1.0}, {1.0,-1.0,-1.0}, {1.0,1.0,-1.0}, {-1.0,1.0,-1.0}, {-1.0,-1.0,1.0}, {1.0,-1.0,1.0}, {1.0,1.0,1.0}, {-1.0,1.0,1.0} }; Suriyong L.

  50. Traversal of the edges of a polygon Inward and outward pointing faces • Be careful about the order of vertices • facing outward: vertices order is 0, 3, 2, 1 etc., obey right hand rule Suriyong L.