Presentation is loading. Please wait.

Presentation is loading. Please wait.

COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 1 Representation of Curves and Surfaces Graphics.

Similar presentations


Presentation on theme: "COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 1 Representation of Curves and Surfaces Graphics."— Presentation transcript:

1 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 1 Representation of Curves and Surfaces Graphics Systems / Computer Graphics and Interfaces

2 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 2 Representation of Curves and Surfaces Representation of surfaces: Allow describing objects through their cheeks. The three most common representations are: –Polygonal mesh –Bicúbicas parametric surfaces –Quadratic surfaces Parametric representation of curves: Important in computer graphics and 2D because of parametric surfaces are a generalization of these curves. "Tea-pot" modeled by smooth curved surfaces (bicúbicas). Reference model in computer graphics, especially for new techniques of realism texture and surface testing. Created by Martin Newell (1975)

3 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 3 Polygonal Mesh Polygonal Mesh: Is a collection of edges, vertices and polygons interconnected so that each edge is shared only a maximum of two polygons. Curve   polyline Section of a curved object. The approximation error can be reduced by increasing the number of polygons. 3D object represented by polygon mesh.

4 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 4 Polygonal Mesh Characteristics of polygonal mesh: –An edge connects two vertices. –A polygon is defined by a closed sequence of edges. –An edge is shared by two adjacent polygons or 1. –A vertex is shared by at least two edges. –All edges are part of a polygon. The data structure for represent the polygonal mesh can have multiple configurations, which are evaluated by memory space and Processing time needed to get a response, for example: –Get all the edges that join a given vertex. –Determine the polygons that share an edge or a vertex. –Determine the vertices attached to an edge. –Determine the edges of a polygon. –Plot the mesh. –Identify errors in the representation, as the lack of an edge, vertex or polygon.

5 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 5 Polygonal Mesh. 1 Representation Explains: each polygon is represented as a list of coordinates of the vertices that constitute it. An edge is defined by two consecutive vertices and between the last and first on the list. (X1, y1, z1) (X2, y2, z2) (X3, y3, z3) (X4, y4, z4) P = ((x1, y1, z1), (x2, y2, z2),..., (xn, yn, zn)) Evaluation of the data structure: –Memory consumption (repeated vertices). –There is an explicit representation of edges and vertices shared. –In the graphical representation of the same edge is "clipped"Drawn and more than once. –When you drag a vertex is necessary to know all the edges that share that vertex. 4x 3x

6 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 6 Polygonal Mesh. 2 Representation of Pointers to List of Vertices: each polygon is represented by a list of indices (or pointers) for a list of vertices. V = ((x1, y1, z1), (x2, y2, z2),..., (xn, yn, zn)) List of Vertices Advantages: –Each vertex of the polygon mesh is stored only once in memory. –The coordinate of a vertex is easily changed. Disadvantages: –Hard to get the polygons that share a given edge. –The edges remain "clipped " and drawn once more. V = (V1, V2, V3, V4) = (x1, y1, z1), (x2, y2, z2),..., (x4, y4, z4)) P1 = (1,2,4) P2 = (4,2,3)

7 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 7 Polygonal Mesh. 3 Representation of Pointers to List of Edges: each polygon is represented by a list of pointers to a list of edges, wherein each edge appears only once. In turn, each edge points to two vertices that define it and also stores the polygons which it belongs. A polygon is represented by P = (E1, E2,..., En) and an edge as E = (V1, V2, P1, P2). If the edge belongs to only one polygon then P2 it is null.

8 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 8 Polygonal Mesh Advantages: –The graphic design is easily obtained by scrolling through the list of edges. Not repeating occurs clipping or drawing. –To fill (color) of the polygons works with a list of polygons. Easy operation is performed clipping on the polygons. Disadvantages: –Still not immediately determine the edges that focus on the same vertex. Solution Baumgart Each vertex has a pointer to one of the edges (random) which focuses this vertex. Each edge has pointers to the edges that cover a vertex.

9 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 9 Curves Cubic Motivation: Smooth curves represent the real world. Representation by polygonal mesh is a first order approximation: –The curve is approximated by a sequence of linear segments. –Large amount of data (vertices) to obtain the curve precisely. –Unwieldy to change the shape of the curve, ie several points need to position accurately. Are generally used polynomials grade 3 (Curves Cubic), and the complete curve formed by a number of cubic curves. –degree <3 offer little flexibility in controlling the shape of the curves and for an interpolation between two points with the definition of the derivative at the end points. A polynomial of degree 2 is specified by three points that define the plane where the curve takes place. –degree > 3 may introduce unwanted oscillations and requires more computational calculation.

10 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 10 Curves Cubic The representation of the curves is in the form PARAMETRIC: x = f x (T), y = f y (T) ex: x = 3t 3 + T 2 y = 2t 3 + T The explicit form: y = f (x) and x: y = x 3 +2 X 2 1. We can not have multiple values y for the same x 2. Curves can not describe with vertical tangents The implicit form: f (x, y) = 0 and x: x 2 + Y 2 -R 2 = 0 1. Restrictions need to be able to model only part of the curve 2. Difficult join two curves smoothly

11 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 11 Curves Parametric cubic The figure shows a curve formed by two parametric cubic curves in 2D.

12 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 12 Curves Parametric cubic General representation of the curve: x (t) = a x t 3 + B x t 2 + C x t + d x y (t) = a y t 3 + B y t 2 + C y t + d y z (t) = a z t 3 + B z t 2 + C z t + d z 0≤ t ≤ 1 Being:

13 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 13 Curves Parametric cubic The above representation is used to represent a single curve. Bring together the various segments of the curve? We intend joining a point  geometric continuity and That have the same slope at the junction  smoothness (continuity of the derivative). Ensuring continuity and smoothness at the junction is ensured by matching the derivatives (tangent) curves at the junction point. To this end calculates: With:

14 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 14 Curves Parametric cubic Types of Continuity: G 0 - Zero geometric continuity  curves join at a point. G 1 - Geometric continuity is an  the direction of the tangent vectors is equal. C 1 - Parametric continuity 1  the tangent at the point of junction have the same direction and amplitude (the first derivative equal). C n - Parametric continuity n  curves have at the junction point all the same derivatives up to order n.

15 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 15 Curves Parametric cubic If we consider tas timeThe continuity C 1 means that the speed of an object moving along the curve remains continuous The continuity C 2 imply that the acceleration would also be continuous. At the junction point of the curve S the curves C 0,C 1 and C 2 we have: Continuity G 0 between SandC 0 Continuity C 1 between SandC 1 Continuity C 2 between SandC 2

16 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 16 Curves Parametric cubic Parametric continuity is more restrictive than the geometric continuity: For example: C 1 implies G 1 At the junction point P 2 we have: Q 2 and Q 3 are G 1 with Q 1 Only Q 2 C is 1 with Q 1 (TV 1 = TV 2 )

17 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 17 Curves Cubic Parametric - Types of Curves 1.Hermite curves −Continuity G 1 at junction points −Geometric vectors: 2 endpoints and The tangent vectors at those points 2.Bezier curves −Continuity G 1 at junction points −Geometric vectors: 2 endpoints and 2 points that control the tangent vectors such extremes 3.Curves Splines −Very extended family of curves −Greater control continuity at junction points (C Continuity 1 and C 2 ) P4P4 P1P1 R4R4 R1R1 P3P3 P4P4 P1P1 P2P2

18 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 18 Common notation Matrix T Matrix Base Matrix Geometric Matrix Base:Characterizes the type of curve Matrix Geometric:A given geometrically conditions and contains curve related to the values ​​ of the curve geometry.

19 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 19 Common notation Conclusion 1: Q (t) is a weighted sum of the elements of the geometric vector Conclusion 2: Weights are cubic polynomials in t  FUNCTIONS MIX (Blending functions)

20 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 20 Hermite curves Geometric vectors:

21 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 21 Hermite curves Mixing functions (Blending functions) Q (t) = (2t 3 -3t 2 +1) P 1 + (-2t 3 +3 T 2 ) P 4 + (T 3 -2t 2 + T) R 1 + (T 3 -T 2 ) R 4 Mixing functions of Hermite curves, referenced by the element of the geometric vector that multiplies, respectively.

22 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 22 Hermite curves - Example Left: Functions of heavy mixture by the appropriate factor from the geometric vector. Center: Y (t) = sum of the four functions of the left Right: Hermite curve

23 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 23 Hermite curves - Examples - P 1 and P 4 fixed - R 4 fixed - R 1 varies in amplitude - P 1 and P 4 fixed - R 4 fixed - R 1 varies in the direction

24 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 24 Hermite curves Example of Interactive Design The extreme points can be repositioned The tangent vectors can be changed by pulling the arrows The tangent vectors are forced to be collinear (L continuity 1 ) And R 4 is displayed in the opposite direction (higher visibility) It is common to have commands to force continuity G 0, G 1 or C 1 Continuity at the junction: K> 0  G 1 K = 1  C 1

25 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 25 Hermite curves

26 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 26 Bezier curves Vector Geometric: P3P3 P4P4 P1P1 P2P2 For a given curve demonstrates that compared with G H : R 1 = Q '(0) = 3. (P 2 - P 1 ) R 4 = Q '(1) = 3. (P 4 - P 3 ) G H M = HB. G B

27 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 27 Bezier curves The same Bezier curve representation: Q (t) = t. M B. G B Q (t) = (1-t) 3 P 1 + 3t (1-t) 2 P 2 + 3t 2 (1-t) P 3 + t 3 P 4

28 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 28 Bezier curves Additional information about the functions of Mixture: -For t = 0 Q (t) = P 1 For t = 1 Q (t) = P 4  The curve passes P 1 and P 4 -The sum at any point is 1. -It is noted that Q (t) is a weighted average of the four control points, Then the curve is contained within the polygon convex (2D) or convex polyhedron (3D) defined by these points, called the "convex hull". What advantage can we draw here? Q (t) = (1-t) 3 P 1 + 3t (1-t) 2 P 2 + 3t 2 (1-t) P 3 + t 3 P 4

29 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 29 Bezier curves Binding of Bezier curves Continuity G 1 : P 4 - P 3 K = (P 5 - P 4 ) With K> 0 i.e. P 3 P 4 and P 5 must be collinear Continuity C 1 : P 4 - P 3 K = (P 5 - P 4 ) Restricting K = 1

30 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 30 Drawing of Cubic curves Two algorithms: 1. Evaluation x (t), y (t) and z (t) incremental values ​​ for t between 0 and 1. 2 Subdivision of the curve:. Casteljau Algorithm 1.Evaluation x (t), y (t) and z (t) Horner's rule reduces the number of multiplications, 11 additions and 10 to 9 and 10, respectively operations. f (t) = at 3 + Bt 2 + Ct + d = ((at + b). + T c). T + d 2.Casteljau algorithm Perform the recursive subdivision of the curve, stopping only when the curve in question is sufficiently "flat" to be able to be approximated by a line segment. Efficient Algorithm: 6 requires only shifts and 6 additions in each division.

31 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 31 Drawing of Cubic curves - Casteljau Algorithm Possible stopping criteria: - The curve in question is sufficiently "flat" to be able to be approximated by a line segment. - The four control points are on the same pixel. L 2 = (P 1 + P 2 ) / 2, H = (P 2 + P 3 ) / 2, L 3 = (L 2 + M) / 2, R 3 = (P 3 + P 4 ) / 2 R 2 = (H + R 3 ) / 2, L 4 = R 1 = (L 3 + R 2 ) / 2

32 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 32 Drawing of Cubic curves Algorithm Calteljau void DrawCurveRecSub (curve,ε) {if (Straight (curve,ε)) DrawLine (curve); else { SubdivideCurve (curve,leftCurve, rightCurve); DrawCurveRecSub (leftCurve, ε); DrawCurveRecSub (rightCurve, ε); }

33 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 33 Exercise

34 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 34 Cubic Surfaces Cubic surfaces are a generalization of cubic curves. The equation of the surface is obtained from the equation of the curve: Q (t) = T. M. G, being G constant. Switch to variable s:Q (s) = S. M. G By varying the points of the vector G3D eométrico along a path parameterized by t are obtained: The geometrical matrix is ​​ composed of 16 points.

35 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 35 Surface Hermite For the x coordinate: It is concluded that:

36 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 36 Surface Hermite

37 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 37 Bezier Surface The equations for the Bezier surface can be obtained in the same way that the Hermite, resulting in: The geometric matrix has 16 control points.

38 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 38 Bezier Surface Continuity C 0 and G 0 is obtained by matching the four points of border control: P 14 P 24 P 34 P 44 For G 1 should be collinear: P 13 P 14 and P 15 P 23 P 24 and P 25 P 33 P 34 and P 35 P 43 P 44 and P 45 and (P 14 -P 13 ) / (P 15 - P 14 ) = K (P 24 -P 23 ) / (P 25 - P 24 ) = K (P 34 -P 33 ) / (P 35 - P 34 ) = K (P 44 -P 43 ) / (P 45 - P 44 ) = K


Download ppt "COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 1 Representation of Curves and Surfaces Graphics."

Similar presentations


Ads by Google