150 likes | 316 Views
How to Make Good Meshes. John C. Hart CS 319 Advanced Topics in Computer Graphics. Meshing. Properties Manifold Delaunay Representations Winged-Edge Quad-Edge Half-Edge Double-Linked-Face-List.
E N D
How to Make Good Meshes John C. Hart CS 319 Advanced Topics in Computer Graphics
Meshing • Properties • Manifold • Delaunay • Representations • Winged-Edge • Quad-Edge • Half-Edge • Double-Linked-Face-List Guibas & Stolfi. Primitives for the Manipulation of General Subdivisionsand the Computation of Voronoi Diagrams. TOG 4(2), Apr. 1985, pp. 74-123.
Manifolds • Let M be a surface in 3-D • M is a manifold iff a neighborhood of any point x in M is topologically equivalent to the unit disk • Topologically equivalence allows deformation that does not rip, tear or poke holes • Also called homeomorphism • deformation is 1-1, onto and bicontinuous • Need not be differentiable good bad
Piecewise Linear Manifolds • Closed mesh • No dangling faces • Watertight • no holes in the surface • no boundary • orientable • Edges only bound two faces • Euler’s formula V – E + F = 2(C – G) • C = # of components • G = genus (# of donut holes) good bad
Delaunay Triangulation • Any number of ways to connect scattered points in plane with edges • Creates a good looking mesh • Triangle face ABC is in Delaunay triangulation iff circumcircle of every face contains no other vertex • Also Delauney iff every edge has some circle passing through its endpoints that contains no other vertex • Rhymes with “baloney”
Building Delaunay Triangulations • Let L and R be two sets of vertices. • Let TL, TR, and T be the Delaunay triangulations of L, R and LR. • Any edge in T whose endpoints are both in L is in TL. • No new edges added • TL not a subset of T • Any edge in T that is not also in TL nor TR has one endpoint in L and one endpoint in R. • New edges between L and R • TL, TR not subsets of T
CircumcircleTest • The point P is in the circumcircle of triangle ABC iff D(A,B,C,P) > 0 • Assume A,B,C,P cocircular with center x,y and radius r • Then (xA – x)2 + (yA – y)2 = r2 and likewise for B,C and P • Which is equivalent to–2xxA–2yyA+(xA2+yA2)+(x2+y2–r2) = 0and likewise for B,C and P • Equations are linearly dependent z = x2 + y2
Indexed Face Set (x3,y3,z3) (x2,y2,z2) • Popular file format • VRML, Wavefront, etc. • Ordered list of vertices • Prefaced by “v” (Wavefront) • Spatial coordinates x,y,z • Index given by order • List of polygons • Prefaced by “f” (Wavefront) • Ordered list of vertex indices • Length = # of sides • Orientation given by order (x1,y1,z1) (x0,y0,z0) v x0y0z0 v x1y1z1 v x2y2z2 v x3y3z3 f 0 1 2 f 1 3 2
Other Attributes v x0y0z0 v x1y1z1 v x2y2z2 vn a0b0c0 vn a1b1c1 vn a2b2c2 vt u0v0 vt u1v1 vt u2v2 (x2,y2,z2)(a2,b2,c2) (u2,v2) • Vertex normals • Prefixed w/ “vn” (Wavefront) • Contains x,y,z of normal • Not necessarily unit length • Not necessarily in vertex order • Indexed as with vertices • Texture coordinates • Prefixed with “vt” (Wavefront) • Not necessarily in vertex order • Contains u,v surface parameters • Faces • Uses “/” to separate indices • Vertex “/” normal “/” texture • Normal and texture optional • Can eliminate normal with “//” (x0,y0,z0) (a0,b0,c0) (u0,v0) (x1,y1,z1)(a1,b1,c1) (u1,v1) f 0/0/0 1/1/1 2/2/2 f 0/0/0 1/0/1 2/0/2
Winged-Edge • Edge pointers • to two endpoint vertices • to two faces that share edge • to four edges emanating from its endpoints • Faces, vertices contain pointer to one edge • Faces outlines by walking edges • Mesh information really contained in edge datastructure
Quad-Edge Operators e Dest e Lnext • Edge e orientation and direction • Orientation is surface normal • Direction is from origin vertex (e Org) to destination vertex (e Dest) • Sym operator toggles direction • e Org = e Sym Dest • Flip operator toggles orientation • e Left = e Flip Right • e Onext = next edge (ccw) with same origin • e Left = e Onext Right • e Left = e Lnext Left e Right e Left e e Onext e Org Sym e Sym e Flip e Sym Flip e Flip
Dual Meshes • Dual of a mesh exchanges faces and vertices • Place new vertices at centroid of faces • Edges in dual cross original edges • at right angles • at midpoints • but might not actually “cross” • E.g. Dual of a Delaunay triangulation is a Voronoi diagram • Voronoi faces denote regions closer to corresponding Delaunay vertex than any other Delaunay vertex
Dual Edge Operator e e Dual • Dual operator rotates edge 90 degrees clockwise • Definition • e Dual Dual = e • e Sym Dual = e Dual Sym • e Flip Dual = e Dual Flip Sym • e Lnext Dual = e Dual Onext-1 • Dual mesh is “inside out” and flips its edges • Rot operation avoids flipping • e Rot = e Flip Dual • e Rot Rot = e Sym e Dual e e e Rot
Fun w/ Quad Edge e Lnext e Dest • e Rot4 = e • e Rot Onext Rot Onext = e • e Rot2 e (but = e Sym) • e Flip2 = e • e Flip Onext Flip Onext = e • e Flip Onextn e for any n • e Flip Rot Flip Rot = e • e Flip-1 = e Flip • e Rot-1 = e Rot3 = e Flip Rot Flip • e Dual = e Flip Rot • e Onext-1 = e Rot Onext Rot = e Flip Onext Flip e Right e Left e e Onext e Org e Dual e e e Rot
Implementation • All we need is • Rot • Flip • Onext • Edge reference <e,r,f> • e Rotr Flipf • r: 0..3 • f: 0..1 (above/below bit) • Quarter record e[r] contains • Data (geometry) • Next e Rotr Onext <e,r,f> Rot = <e, (r+1+2f)%4, f> <e,r,f> Flip = <e, r, (f+1)%2> <e,r,f> Onext = <e[(r+f)%4].Next> Rotf Flipf <e,r,0> Onext = <e[r].Next> <e,r,1> Onext = <e[r+1].Next> Rot Flip (= <e,r,0> Rot Onext Rot Flip) (= <e,r,0> Onext-1 Flip) If meshes always orientable <e,r> Rot = <e,r+1> <e,r> Onext = e[r].Next <e,r> Sym = <e,r+2>