340 likes | 365 Views
Chapter 6: Polygonal Meshes. 6.2 Introduction Polygonal mesh: collection of polygons (faces) List of polygons, each with direction (normal vector) Vertex normals vs. face normals Vertex normal facilitates clipping and shading. 6.2.1 Defining a polygonal mesh
E N D
Chapter 6: Polygonal Meshes • 6.2 Introduction • Polygonal mesh: collection of polygons (faces) • List of polygons, each with direction (normal vector) • Vertex normals vs. face normals • Vertex normal facilitates clipping and shading. • 6.2.1 Defining a polygonal mesh • Vertex list (geometric information) • Normal list (orientation information) • Face list (topological information) CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.2.2 Finding the Normal Vectors • Newell’s method. • N is number of vertices in face, (xi,yi,zi) is position of i-th vertex, and next(j)=(j+1) mod N is index of ‘next’ vertex after vertex j. • Calculate mx, my, mz of normal m as: CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.2.3 Properties of meshes • Solid : faces enclose positive finite amount of space • Connected : unbroken path along polygon edges exists between any two vertices • Simple : solid object, no holes (object can be deformed into sphere without tearing) • Planar : every face is planar polygon • Convex : line connecting any two point in object lies wholly inside object. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.2.4 Mesh Models for Nonsolid Objects • surfaces CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.2.5 Working with Meshes in a Program • Class Mesh, with vertex list, normal list, face list • Using SDL to draw mesh: Selfstudy. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.3 Polyhedra • Polyhedron is connected mesh of simple planar polygons that encloses finite amount of space. • Every edge shared by exactly two faces • At least three edges meet at each vertex • Faces do not interpenetrate: Either don’t touch, or only touch along common edge. • Euler’s formula: V + F – E = 2 (simple polyhedron) V + F - E = 2 + H - 2G (non-simple polyhedron) CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Schlegel diagram: View from outside center of a given face • 6.3.1 Prisms and antiprisms • Prism defined by sweeping polygon along straight line • Regular prism has regular polygon base, and squares for side faces CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Antiprism : top n-gon rotated 180/n degrees; connected to bottom n-gon to form faces which are equilateral triangles • 6.3.2 Platonic solids • Polyhedron; identical faces; each face regular polygon regular polyhedron CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Only 5 such objects! Platonic solids • Schäfli symbol (p,q) ; each face is p-gon, q faces meet at each vertex. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Dual polyhedra: Each Platonic solid has dual D • Vertices of D is centers of faces of P edges of D connect midpoints of adjacent faces of P • Dual can be constructed directly from P • Model to keep track of vertex and face numbering • Detail : Selfstudy CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Normal vectors for Platonic solids • Assume solid centered at origin, then normal to face is vector from origin to center of face, which is average of vertices. • m = (V1+V2+V3)/3 • Selfstudy: Tetrahedron,icosahedron, dodecahedron CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.3.3 Other Interesting Polyhedra • Archimedean (semi-regular) solids • More than one kind of face • Face still regular polygon • Every vertex surrounded by same collection of polygons in same order. • Only 13 possible Archimedean solids • Normal vector still found using center of face. • Examples: truncated cube, Buckyball CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Geodesic domes • Approximate sphere by faces, usually triangles; cut in half • Faces? Each edge divided into 3F equal parts; result projected outward onto sphere. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.4 Extruded shapes • 2D polygon swept through space. • 6.4.1 Creating Prisms • Polygon swept in straight line • Flat face same normal vector with every vertex of face (normal vector to face itself) • Building mesh for prism : Selfstudy • 6.4.2 Arrays of extruded prisms (“Bricklaying”) • Some software (OpenGL) draw only convex polygons • Decompose polygon into sets of convex polygons CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Special case: Extruded Quad-Strips • Quad-strip: array of quadrilaterals connected in chain • Described by sequence of vertices {p0,p1,...,pm-1} • Vertices taken in pairs • When mesh formed as extruded quad-strip, only 2M vertices in vertex list; only “outside walls” included in face list no redundant walls drawn. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.4.3 Extrusions with Twisting • Base polygon P = {p0,p1,..., pN-1} • Cap polygon P’ = {Mp0,Mp1,..., MpN-1} • M is 4x4 matrix representing affine transformation. • 6.4.4 Segmented Extrusions: Tubes and Snakes • Sequence of extrusions, each with own transformation. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Designing Tubes based on 3D Curves • Wrap tube round curve (called spine C(t)), that undulates through space in organized fashion. • Form waist polygon? Sample C(t) at {t0,t1,...} and build transformed polygon in plane perpendicular to curve at each C(ti). CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Frenet frame at each point along spline • Calculate T(ti) tangent to curve; N(ti), B(ti) perpendicular to T and each other. • Mi = ( N(ti) B(ti) T(ti) C(ti) ) • Forming Frenet Frame (for C differentiable) • (t), normalize, get unit tangent vector T(t). • Unit binormal vector B(t): • N(t) = C(t) x B(t) CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Finding Frenet Frame Numerically (C not diff.) • Approximations for derivates; see Hill p. 317. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.4.5 Discretely Swept Surfaces of Revolution • Place all spline points at origin, and use rotation for affine transformation. • Base polygon called profile • Operation equivalent to circularly sweeping shape about axis • Resulting shape called surface of revolution. • Note: only discrete approximation! CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.5 Mesh Approximations to Smooth Objects • Previous: Mesh with each face polygon shape specified by listing data of vertices. • Now: Polygon approximations of object, but with vertices calculated using formulas (evaluate parametric representation of surface at discrete points). • Shading smooth – individual faces invisible. Compute normal to surface. • Create mesh by building vertex list and face list, but vertices computed. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.5.1 Representation of Surfaces • Similar to planar patch P(u,v) = C + au +bv • Generalize: P(u,v) = (X(u,v), Y(u,v), Z(u,v))(point form). • If v constant, u varies: v-contour • If u constant, v varies: u-contour • Implicit Form of Surface • F(x,y,z)=0 iff (x,y,z) is on surface. • F(x,y,z)<0 iff (x,y,z) is inside surface • F(x,y,z)>0 iff (x,y,z) is outside surface CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.5.2 The Normal Vector to a Surface • Case 1: Parametric equation • Planar patch near (u0,v0)essentially flat • Note that partial derivates exist if surface smooth enough. • Also, derivative of vector is vector of derivatives. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Case 2: Implicit equation • The Effect of an Affine Transformation: Selfstudy. • 6.5.4 Generic Shapes: Sphere, Cylinder,Cone • For each shape: Implicit form, parametric form, normal. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.5.5 Polygon Mesh for a Curved Surface • Tesselation – replace surface by collection of triangles and quadrilaterals • Vertices lie in surface, joined by straight edges (not in surface) • Obtain vertices by sampling values of u and v in parametric form of surface; place in vertex list. • Face list from vertices • Associate with each vertex normal to surface. • Selfstudy: rest of pp. 329, 330. CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.5.6 Rules Surfaces • Surface is ruled if, through every one of tis points, there passes at least one line that lies entirely on the surface. • Rules surfaces are swept out by moving a straight line along a particular trajectory. • Parametric form: P(u,v) = (1-v)P0(u) +vP1(u). • P0(u) and P1(u) define curves in 3D space, defined by components P0(u)=(X0(u),Y0(u),Z0(u)). • P0(u) and P1(u) defined on same interval in u. • Ruled surface consists of one straight line joining each pair of points P0(u’) and P1(u’). CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Cones • Ruled surface for which P0(u) is a single point (apex) • Cylinders • Ruled surface for which P1(u) is a translated version of P0(u): P1(u) = P0(u) + d CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Bilinear Patches • P0(u) and P1(u) are straight line segments defined over same interval in u. • Bilinear Blended Surfaces (Coons Patches) • Rules surface that interpolates between four boundary curves CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Formula for patch: add and then subtract, otherwise not affine. • 6.5.7 Surfaces of Revolution • 6.5.8 The Quadric Surfaces • 3D analogs of conic sections CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • Properties of Quadric Surfaces • Trace is curve formed when surface is cut by plane • All traces of quadric surfaces are conic sections. • Principal traces are curves generated when cutting planes aligned with axes. • Selfstudy: Ellipsoid, hyperboloid of one sheet, hyperboloid of two sheets, elliptic cone, elliptic paraboloid, hyperbolic paraboloid • Selfstudy: Normal vectors to quadric surfaces CS Hons RW778 Graphics
Chapter 6: Polygonal Meshes • 6.5.9 Superquadrics : Selfstudy. • 6.5.10 Tubes based on 3D Curves • As before, but normals to surface instead of normals to face – allows smooth shading. • 6.5.11 Surfaces based on Explicit Functions of Two Variables • If surface shape single valued in one dimension, position can be represented as single function of 2 independent variables. • Example: Single value of ‘height’ of surface above xz-plane for each point (x,z). Known as height field. CS Hons RW778 Graphics
Chapter 6: Poygonal Meshes • Programming Task 5 : Taper, twist, bend and squash it. Case Study 6.14, pp. 355-356, Hill. CS Hons RW778 Graphics