+ All Categories
Home > Documents > 2003CS Hons RW778 Graphics1 Chapter 6: Polygonal Meshes 6.2 Introduction 6.2 Introduction...

2003CS Hons RW778 Graphics1 Chapter 6: Polygonal Meshes 6.2 Introduction 6.2 Introduction...

Date post: 28-Dec-2015
Category:
Upload: bryan-edwards
View: 224 times
Download: 4 times
Share this document with a friend
34
2003 CS Hons RW778 Graphics 1 Chapter 6: Polygonal Chapter 6: Polygonal Meshes Meshes 6.2 Introduction 6.2 Introduction Polygonal mesh: collection of polygons Polygonal mesh: collection of polygons (faces) (faces) List of polygons, each with direction List of polygons, each with direction (normal vector) (normal vector) Vertex normals vs. face normals Vertex normals vs. face normals » Vertex normal facilitates clipping and Vertex normal facilitates clipping and shading. shading. 6.2.1 Defining a polygonal mesh 6.2.1 Defining a polygonal mesh » Vertex list (geometric information) Vertex list (geometric information) » Normal list (orientation information) Normal list (orientation information) » Face list (topological information) Face list (topological information)
Transcript

2003 CS Hons RW778 Graphics 1

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.2 Introduction6.2 Introduction– Polygonal mesh: collection of polygons (faces)Polygonal mesh: collection of polygons (faces)

– List of polygons, each with direction (normal vector)List of polygons, each with direction (normal vector)

– Vertex normals vs. face normalsVertex normals vs. face normals» Vertex normal facilitates clipping and shading.Vertex normal facilitates clipping and shading.

– 6.2.1 Defining a polygonal mesh6.2.1 Defining a polygonal mesh» Vertex list (geometric information)Vertex list (geometric information)

» Normal list (orientation information)Normal list (orientation information)

» Face list (topological information)Face list (topological information)

2003 CS Hons RW778 Graphics 2

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.2.2 Finding the Normal Vectors6.2.2 Finding the Normal Vectors– Newell’s method.Newell’s method.

– N is number of vertices in face, (xN is number of vertices in face, (xii,y,yii,z,zii) is position of i-) is position of i-

th vertex, and next(j)=(j+1) mod N is index of ‘next’ th vertex, and next(j)=(j+1) mod N is index of ‘next’ vertex after vertex j.vertex after vertex j.

– Calculate mCalculate mxx, m, myy, m, mzz of normal of normal mm as: as:

1N

0i

)i(nexti)i(nextix )zz)(yy(m

1N

0i

)i(nexti)i(nextiy )xx)(zz(m

1N

0i

)i(nexti)i(nextiz )yy)(xx(m

2003 CS Hons RW778 Graphics 3

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.2.3 Properties of meshes6.2.3 Properties of meshes– Solid : faces enclose positive finite amount of spaceSolid : faces enclose positive finite amount of space

– Connected : unbroken path along polygon edges exists Connected : unbroken path along polygon edges exists between any two verticesbetween any two vertices

– Simple : solid object, no holes (object can be deformed Simple : solid object, no holes (object can be deformed into sphere without tearing)into sphere without tearing)

– Planar : every face is planar polygonPlanar : every face is planar polygon

– Convex : line connecting any two point in object lies Convex : line connecting any two point in object lies wholly inside object.wholly inside object.

2003 CS Hons RW778 Graphics 4

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.2.4 Mesh Models for Nonsolid Objects6.2.4 Mesh Models for Nonsolid Objects– surfaces surfaces

2003 CS Hons RW778 Graphics 5

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.2.5 Working with Meshes in a Program6.2.5 Working with Meshes in a Program– Class Mesh, with vertex list, normal list, face listClass Mesh, with vertex list, normal list, face list

– Using SDL to draw mesh: Selfstudy.Using SDL to draw mesh: Selfstudy.

2003 CS Hons RW778 Graphics 6

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.3 Polyhedra6.3 Polyhedra– Polyhedron is connected mesh of simple planar Polyhedron is connected mesh of simple planar

polygons that encloses finite amount of space.polygons that encloses finite amount of space.» Every edge shared by exactly two facesEvery edge shared by exactly two faces

» At least three edges meet at each vertexAt least three edges meet at each vertex

» Faces do not interpenetrate: Either don’t touch, or only touch Faces do not interpenetrate: Either don’t touch, or only touch along common edge.along common edge.

– Euler’s formula: Euler’s formula: V + F – E = 2 (simple polyhedron)V + F – E = 2 (simple polyhedron)V + F - E = 2 + H - 2G (non-simple polyhedron)V + F - E = 2 + H - 2G (non-simple polyhedron)

2003 CS Hons RW778 Graphics 7

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

– Schlegel diagram: View from outside center of a given Schlegel diagram: View from outside center of a given faceface

6.3.1 Prisms and antiprisms6.3.1 Prisms and antiprisms– Prism defined by sweeping polygon along straight linePrism defined by sweeping polygon along straight line

– Regular prism has regular polygon base, and squares Regular prism has regular polygon base, and squares for side facesfor side faces

2003 CS Hons RW778 Graphics 8

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

– Antiprism : top n-gon rotated 180/n degrees; connected Antiprism : top n-gon rotated 180/n degrees; connected to bottom n-gon to form faces which are equilateral to bottom n-gon to form faces which are equilateral trianglestriangles

6.3.2 Platonic solids6.3.2 Platonic solids– Polyhedron; identical faces; each face regular polygon Polyhedron; identical faces; each face regular polygon

regular polyhedron regular polyhedron

2003 CS Hons RW778 Graphics 9

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

– Only 5 such objects! Platonic solidsOnly 5 such objects! Platonic solids

– Schäfli symbol (p,q) ; each face is p-gon, q faces meet Schäfli symbol (p,q) ; each face is p-gon, q faces meet at each vertex.at each vertex.

2003 CS Hons RW778 Graphics 10

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

– Dual polyhedra: Each Platonic solid has dual DDual polyhedra: Each Platonic solid has dual D

– Vertices of D is centers of faces of P Vertices of D is centers of faces of P edges of D edges of D connect midpoints of adjacent faces of Pconnect midpoints of adjacent faces of P

– Dual can be constructed directly from PDual can be constructed directly from P» Model to keep track of vertex and face numberingModel to keep track of vertex and face numbering

» Detail : SelfstudyDetail : Selfstudy

2003 CS Hons RW778 Graphics 11

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

Normal vectors for Platonic solidsNormal vectors for Platonic solids– Assume solid centered at origin, then normal to face is Assume solid centered at origin, then normal to face is

vector from origin to center of face, which is average of vector from origin to center of face, which is average of vertices.vertices.

– mm = (V = (V11+V+V22+V+V33)/3)/3

– Selfstudy: Tetrahedron,Selfstudy: Tetrahedron,icosahedron, dodecahedronicosahedron, dodecahedron

2003 CS Hons RW778 Graphics 12

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.3.3 Other Interesting Polyhedra6.3.3 Other Interesting Polyhedra– Archimedean (semi-regular) solidsArchimedean (semi-regular) solids

» More than one kind of faceMore than one kind of face

» Face still regular polygonFace still regular polygon

» Every vertex surrounded by same collection of polygons in Every vertex surrounded by same collection of polygons in same order.same order.

– Only 13 possible Archimedean solidsOnly 13 possible Archimedean solids

– Normal vector still found using center of face.Normal vector still found using center of face.

– Examples: truncated cube, BuckyballExamples: truncated cube, Buckyball

2003 CS Hons RW778 Graphics 13

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

2003 CS Hons RW778 Graphics 14

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

Geodesic domesGeodesic domes– Approximate sphere by faces, usually triangles; cut in Approximate sphere by faces, usually triangles; cut in

halfhalf

– Faces? Each edge divided into 3F equal parts; result Faces? Each edge divided into 3F equal parts; result projected outward onto sphere.projected outward onto sphere.

2003 CS Hons RW778 Graphics 15

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.4 Extruded shapes6.4 Extruded shapes– 2D polygon swept through space.2D polygon swept through space.

– 6.4.1 Creating Prisms6.4.1 Creating Prisms» Polygon swept in straight linePolygon swept in straight line

» Flat face Flat face same normal vector with every vertex of face same normal vector with every vertex of face (normal vector to face itself)(normal vector to face itself)

– Building mesh for prism : SelfstudyBuilding mesh for prism : Selfstudy

– 6.4.2 Arrays of extruded prisms (“Bricklaying”)6.4.2 Arrays of extruded prisms (“Bricklaying”)» Some software (OpenGL) draw only convex polygonsSome software (OpenGL) draw only convex polygons

» Decompose polygon into sets of convex polygonsDecompose polygon into sets of convex polygons

2003 CS Hons RW778 Graphics 16

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

– Special case: Extruded Quad-StripsSpecial case: Extruded Quad-Strips» Quad-strip: array of quadrilaterals connected in chainQuad-strip: array of quadrilaterals connected in chain

» Described by sequence of vertices {pDescribed by sequence of vertices {p00,p,p11,...,p,...,pm-1m-1}}

» Vertices taken in pairsVertices taken in pairs

» When mesh formed as extruded quad-strip, only 2M vertices When mesh formed as extruded quad-strip, only 2M vertices in vertex list; only “outside walls” included in face list in vertex list; only “outside walls” included in face list no no redundant walls drawn.redundant walls drawn.

2003 CS Hons RW778 Graphics 17

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.4.3 Extrusions with Twisting6.4.3 Extrusions with Twisting– Base polygon P = {pBase polygon P = {p00,p,p11,..., p,..., pN-1N-1}}

– Cap polygon P’ = {MpCap polygon P’ = {Mp00,Mp,Mp11,..., Mp,..., MpN-1N-1}}

– M is 4x4 matrix representing affine transformation.M is 4x4 matrix representing affine transformation.

6.4.4 Segmented Extrusions: Tubes and Snakes6.4.4 Segmented Extrusions: Tubes and Snakes– Sequence of extrusions, each with own transformation.Sequence of extrusions, each with own transformation.

2003 CS Hons RW778 Graphics 18

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

Designing Tubes based on 3D CurvesDesigning Tubes based on 3D Curves– Wrap tube round curve (called spine C(t)), that Wrap tube round curve (called spine C(t)), that

undulates through space in organized fashion.undulates through space in organized fashion.

– Form waist polygon? Sample C(t) at {tForm waist polygon? Sample C(t) at {t00,t,t11,...} and build ,...} and build

transformed polygon in plane perpendicular to curve at transformed polygon in plane perpendicular to curve at each C(teach C(tii).).

2003 CS Hons RW778 Graphics 19

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

– Frenet frame at each point along splineFrenet frame at each point along spline» Calculate Calculate TT(t(tii) tangent to curve; ) tangent to curve; NN(t(tii),), B B(t(tii) perpendicular to ) perpendicular to TT

and each other.and each other.

– MMii = ( = ( NN(t(tii) ) B B(t(tii) ) TT(t(tii) ) C(tC(tii) )) )– Forming Frenet Frame (for C differentiable)Forming Frenet Frame (for C differentiable)

» (t), normalize, get unit tangent vector (t), normalize, get unit tangent vector TT(t).(t).» Unit binormal vector Unit binormal vector BB(t):(t):

» NN(t) = (t) = CC(t) x (t) x BB(t)(t)

C

2003 CS Hons RW778 Graphics 20

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

– Finding Frenet Frame Numerically (C not diff.)Finding Frenet Frame Numerically (C not diff.)» Approximations for derivates; see Hill p. 317.Approximations for derivates; see Hill p. 317.

2003 CS Hons RW778 Graphics 21

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.4.5 Discretely Swept Surfaces of Revolution6.4.5 Discretely Swept Surfaces of Revolution– Place all spline points at origin, and use rotation for affine Place all spline points at origin, and use rotation for affine

transformation.transformation.

– Base polygon called profileBase polygon called profile

– Operation equivalent to circularly sweeping shape about axisOperation equivalent to circularly sweeping shape about axis

– Resulting shape called Resulting shape called surface of revolution.surface of revolution.

– Note: only discrete approximation!Note: only discrete approximation!

2003 CS Hons RW778 Graphics 22

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.5 Mesh Approximations to Smooth Objects6.5 Mesh Approximations to Smooth Objects– Previous: Mesh with each face polygon shape specified Previous: Mesh with each face polygon shape specified

by listing data of vertices.by listing data of vertices.

– Now: Polygon approximations of object, but with Now: Polygon approximations of object, but with vertices calculated using formulas (evaluate parametric vertices calculated using formulas (evaluate parametric representation of surface at discrete points).representation of surface at discrete points).

– Shading smooth – individual faces invisible. Compute Shading smooth – individual faces invisible. Compute normal to surface.normal to surface.

– Create mesh by building vertex list and face list, but Create mesh by building vertex list and face list, but vertices computed.vertices computed.

2003 CS Hons RW778 Graphics 23

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.5.1 Representation of Surfaces6.5.1 Representation of Surfaces– Similar to planar patch P(u,v) = C + Similar to planar patch P(u,v) = C + aau +u +bbvv– Generalize: P(u,v) = (X(u,v), Y(u,v), Z(u,v))Generalize: P(u,v) = (X(u,v), Y(u,v), Z(u,v))

(point form).(point form).– If v constant, u varies: v-contourIf v constant, u varies: v-contour– If u constant, v varies: u-contour If u constant, v varies: u-contour

Implicit Form of SurfaceImplicit 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 on surface.– F(x,y,z)<0 iff (x,y,z) is inside surfaceF(x,y,z)<0 iff (x,y,z) is inside surface– F(x,y,z)>0 iff (x,y,z) is outside surfaceF(x,y,z)>0 iff (x,y,z) is outside surface

2003 CS Hons RW778 Graphics 24

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.5.2 The Normal Vector to a Surface6.5.2 The Normal Vector to a Surface– Case 1: Parametric equationCase 1: Parametric equation

– Planar patch near (uPlanar patch near (u00,v,v00))

essentially flatessentially flat

– Note that partial derivates exist if surface smooth Note that partial derivates exist if surface smooth enough.enough.

– Also, derivative of vector is vector of derivatives.Also, derivative of vector is vector of derivatives.

vu

vv,uu

00

00

)v,u(pp

n

2003 CS Hons RW778 Graphics 25

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

– Case 2: Implicit equationCase 2: Implicit equation

– The Effect of an Affine Transformation: Selfstudy.The Effect of an Affine Transformation: Selfstudy.

6.5.4 Generic Shapes: Sphere, Cylinder,Cone6.5.4 Generic Shapes: Sphere, Cylinder,Cone– For each shape: Implicit form, parametric form, For each shape: Implicit form, parametric form,

normal.normal.

zF

,yF

,xF

zz,yy,xx

0,00

000

)zy,x(n

2003 CS Hons RW778 Graphics 26

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.5.5 Polygon Mesh for a Curved Surface6.5.5 Polygon Mesh for a Curved Surface– Tesselation – replace surface by collection of triangles Tesselation – replace surface by collection of triangles

and quadrilateralsand quadrilaterals

– Vertices lie in surface, joined by straight edges (not in Vertices lie in surface, joined by straight edges (not in surface)surface)

– Obtain vertices by sampling values of u and v in Obtain vertices by sampling values of u and v in parametric form of surface; place in vertex list.parametric form of surface; place in vertex list.

– Face list from verticesFace list from vertices

– Associate with each vertex normal to Associate with each vertex normal to surfacesurface..

– Selfstudy: rest of pp. 329, 330.Selfstudy: rest of pp. 329, 330.

2003 CS Hons RW778 Graphics 27

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.5.6 Rules Surfaces6.5.6 Rules Surfaces– Surface is ruled if, through every one of tis points, there Surface is ruled if, through every one of tis points, there

passes at least one line that lies entirely on the surface.passes at least one line that lies entirely on the surface.– Rules surfaces are swept out by moving a straight line Rules surfaces are swept out by moving a straight line

along a particular trajectory.along a particular trajectory.– Parametric form: P(u,v) = (1-v)PParametric form: P(u,v) = (1-v)P00(u) +vP(u) +vP11(u).(u).– PP00(u) and P(u) and P11(u) define curves in 3D space, defined by (u) define curves in 3D space, defined by

components Pcomponents P00(u)=(X(u)=(X00(u),Y(u),Y00(u),Z(u),Z00(u)).(u)).– PP00(u) and P(u) and P11(u) defined on same interval in u.(u) defined on same interval in u.– Ruled surface consists of one straight line joining each Ruled surface consists of one straight line joining each

pair of points Ppair of points P00(u’) and P(u’) and P11(u’).(u’).

2003 CS Hons RW778 Graphics 28

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

ConesCones– Ruled surface for which PRuled surface for which P00(u) is a single point (apex)(u) is a single point (apex)

CylindersCylinders– Ruled surface for which PRuled surface for which P11(u) is a translated version of (u) is a translated version of

PP00(u): P(u): P11(u) = P(u) = P00(u) + (u) + dd

2003 CS Hons RW778 Graphics 29

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

Bilinear PatchesBilinear Patches– PP00(u) and P(u) and P11(u) are straight line segments defined over (u) are straight line segments defined over

same interval in u.same interval in u.

Bilinear Blended Surfaces (Coons Patches)Bilinear Blended Surfaces (Coons Patches)– Rules surface that interpolates between four boundary Rules surface that interpolates between four boundary

curvescurves

2003 CS Hons RW778 Graphics 30

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

– Formula for patch: add and then subtract, otherwise not Formula for patch: add and then subtract, otherwise not affine.affine.

6.5.7 Surfaces of Revolution6.5.7 Surfaces of Revolution 6.5.8 The Quadric Surfaces6.5.8 The Quadric Surfaces

– 3D analogs of conic sections3D analogs of conic sections

2003 CS Hons RW778 Graphics 31

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

2003 CS Hons RW778 Graphics 32

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

Properties of Quadric SurfacesProperties of Quadric Surfaces– Trace is curve formed when surface is cut by planeTrace is curve formed when surface is cut by plane

» All traces of quadric surfaces are conic sections.All traces of quadric surfaces are conic sections.

– Principal traces are curves generated when cutting Principal traces are curves generated when cutting planes aligned with axes.planes aligned with axes.

– Selfstudy: Ellipsoid, hyperboloid of one sheet, Selfstudy: Ellipsoid, hyperboloid of one sheet, hyperboloid of two sheets, elliptic cone, elliptic hyperboloid of two sheets, elliptic cone, elliptic paraboloid, hyperbolic paraboloidparaboloid, hyperbolic paraboloid

– Selfstudy: Normal vectors to quadric surfacesSelfstudy: Normal vectors to quadric surfaces

2003 CS Hons RW778 Graphics 33

Chapter 6: Polygonal MeshesChapter 6: Polygonal Meshes

6.5.9 Superquadrics : Selfstudy.6.5.9 Superquadrics : Selfstudy. 6.5.10 Tubes based on 3D Curves6.5.10 Tubes based on 3D Curves

– As before, but normals to surface instead of normals to As before, but normals to surface instead of normals to face – allows smooth shading.face – allows smooth shading.

6.5.11 Surfaces based on Explicit Functions of 6.5.11 Surfaces based on Explicit Functions of Two VariablesTwo Variables– If surface shape single valued in one dimension, If surface shape single valued in one dimension,

position can be represented as single function of 2 position can be represented as single function of 2 independent variables.independent variables.

– Example: Single value of ‘height’ of surface above xz-Example: Single value of ‘height’ of surface above xz-plane for each point (x,z). Known as height field.plane for each point (x,z). Known as height field.

2003 CS Hons RW778 Graphics 34

Chapter 6: Poygonal MeshesChapter 6: Poygonal Meshes

Programming Task 5Programming Task 5 : Taper, twist, bend : Taper, twist, bend and squash it. Case Study 6.14, pp. 355-and squash it. Case Study 6.14, pp. 355-356, Hill.356, Hill.


Recommended