1 / 100

Geometric Objects and Transformations

Geometric Objects and Transformations. Coordinate systems and frames Working with representation Object transformation. Introduction. Mathematical of Object Euclidean vector spaces Vector space with measure of size Independent of coordinate system Parametric form system.

tyrell
Download Presentation

Geometric Objects and Transformations

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. 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 For vectors, For points The operation of vector-scalar multiplication |av| = |a||v| Subtraction of two points, P and Q -> vectorv v=P-Q Add vector with point get point P = v + Q Vector-vector operation can be in point form (P-Q) + (Q-R) = P-R 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 is the orthogonal projection of u onto v 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 S(a) =aP+ (1-a)Q 0 <= a <=1 and T(a, b) = bS(a) + (1-b)R Where 0 <= b <= 1 Suriyong L.

  24. General plane equation T-T0 = au + bv The plane can have vector(normal vector) formed from u and v Let n = plane vector Thus n = u xv 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 w =a1v1 + a2v2 +a3v3 1, 2 and 3 : components of w 1,2 and 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 • = 1e1+2e2+3e3 Where e1 e2 e3 : basis vector • In column matrix form a = 1e1+2e2+3e3 (1, 2, 3): called 3-tuple of scalars • Known as Euclidean R3: Suriyong L.

  30. Coordinate systems changing • World/user frame <-> camera frame • Done by model view matrix • Use 2 basis sets of vector u and v • Represent u by v M : representation matrix from u to v Suriyong L.

  31. Let Where Equivalently Then using our representation of the second basis in terms of the first, we find that Where 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 v1, v2, and v3 to one in which the basis vector are u1, u2 and u3 is In the new system, the representation of w is That is Suriyong L.

  35. Homogeneous Coordinate • We use only 3 basis vector is not enough to make point and vector different • For any point: // General equation for 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 We may say that The yellow matrix called homogeneous-coordinate representationof point P Suriyong L.

  36. In the same frame, any vector w can be written Thus, w can be represented by the column matrix If (v1, v2, v3, P0) and (u1, u2, u3, Q0) we can express as Suriyong L.

  37. M : the matrix representation of the change of frames. Suppose a and b are the homogeneous-coordinate representations, then Suriyong L.

  38. When we work with representations, as is usually the case, we are interested in MT, 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. We can move back and forth between representation Thus Suppose want to move the point to (1, 2, 3, 1) The displacement vector is v = v1 + 2v2+3v3 And move from point P0 to Q0 then Q0 = P0 +v1 + 2v2+3v3 The matrix MT becomes Its inverse is 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. Camera at (1,0,1) pointing toward the origin Suppose camera at point (1, 0, 1, 1) • World frame center point of camera p = (1, 0, 1, 1)T • Representation of world frame for camera n = (-1, 0, -1, 0)T • Camera orientation: up or down v = (0, 1, 0, 0)T • Forming orthogonal product for determining v let’s say u u = (1, 0, -1, 0)T 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.

More Related