Triangle Meshes Notation Validity of Triangle Meshes Topology/Geometry

Triangle Meshes Notation Validity of Triangle Meshes Topology/Geometry

Notation • nT = #tris; nV = #verts; nE = #edges • Euler: nV – nE + nT = 2 for a simple closed surface Triangle meshes – and in general sums to small integer – argument for implication that nT:nE:nV is about 2:3:1 CS 4620 Lecture 11 y et al.] ole [F Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 1 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 2 Validity of triangle meshes Topology/geometry examples • in many cases we care about the mesh being able to • same geometry, different mesh topology: bound a region of space nicely • in other cases we want triangle meshes to fulfill assumptions of algorithms that will operate on them (and may fail on malformed input) • two completely separate issues: • same mesh topology, different geometry: – topology: how the triangles are connected (ignoring the positions entirely) – geometry: where the triangles are in 3D space Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 3 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 4 Topological validity Geometric validity • strongest property, and most simple: be a manifold • generally want non-self-intersecting surface – this means that no points should be "special" • hard to guarantee in general – interior points are fine – because far-apart parts of mesh might intersect – edge points: each edge should have exactly 2 triangles – vertex points: each vertex should have one loop of triangles • not too hard to weaken this to allow boundaries y et al.] ole [F Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 5 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 6 Representation of triangle meshes Representations for triangle meshes • Compactness • Separate triangles • Efficiency for rendering • Indexed triangle set – enumerate all triangles as triples of 3D points – shared vertices • Efficiency of queries • Triangle strips and triangle fans – all vertices of a triangle – compression schemes for transmission to hardware" – all triangles around a vertex • Triangle-neighbor data structure – neighboring triangles of a triangle – supports adjacency queries – (need depends on application) • Winged-edge data structure • finding triangle strips – supports general polygon meshes • computing subdivision surfaces • mesh editing Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 7 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 8 Separate triangles Separate triangles • array of triples of points – float[nT][3][3]: about 72 bytes per vertex • 2 triangles per vertex (on average) • 3 vertices per triangle • 3 coordinates per vertex • 4 bytes per coordinate (float) • various problems – wastes space (each vertex stored 6 times) – cracks due to roundoff – difficulty of finding neighbors at all Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 9 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 10 Indexed triangle set Indexed triangle set • Store each vertex once • Store each vertex once • Each triangle points to its three vertices • Each triangle points to its three vertices Triangle { Triangle { Vertex vertex[3]; Vertex vertex[3]; } } Vertex { Vertex { float position[3]; // or other data float position[3]; // or other data } } // ... or ... // ... or ... Mesh { Mesh { float verts[nv][3]; // vertex positions (or other data) float verts[nv][3]; // vertex positions (or other data) int tInd[nt][3]; // vertex indices int tInd[nt][3]; // vertex indices } } Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 11 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 11 Indexed triangle set Indexed triangle set • array of vertex positions – float[nV][3]: 12 bytes per vertex • (3 coordinates x 4 bytes) per vertex • array of triples of indices (per triangle) – int[nT][3]: about 24 bytes per vertex • 2 triangles per vertex (on average) • (3 indices x 4 bytes) per triangle • total storage: 36 bytes per vertex (factor of 2 savings) • represents topology and geometry separately • finding neighbors is at least well defined Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 12 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 13 Triangle strips Triangle strips • Take advantage of the mesh property – each triangle is usually adjacent to the previous – let every vertex create a triangle by reusing the second and third vertices of the previous triangle 4, 0 – every sequence of three vertices produces a triangle (but not in the same order) – e. g., 0, 1, 2, 3, 4, 5, 6, 7, … leads to # (0 1 2), (2 1 3), (2 3 4), (4 3 5), (4 5 6), (6 5 7), … – for long strips, this requires about one index per triangle Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 14 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 15 Triangle strips Triangle strips • array of vertex positions – float[nV][3]: 12 bytes per vertex • (3 coordinates x 4 bytes) per vertex • array of index lists – int[n ][variable]: 2 + n indices per strip 4, 0 S – on average, (1 + !) indices per triangle (assuming long strips) • 2 triangles per vertex (on average) • about 4 bytes per triangle (on average) • total is 20 bytes per vertex (limiting best case) – factor of 3.6 over separate triangles; 1.8 over indexed mesh Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 15 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 16 Triangle fans Triangle neighbor structure • Same idea as triangle strips, but keep oldest rather than • Extension to indexed newest triangle set – every sequence of three vertices produces a triangle • Triangle points to its three – e. g., 0, 1, 2, 3, 4, 5, … leads to neighboring triangles # (0 1 2), (0 2 3), (0 3 4), (0 3 5), … • Vertex points to a single – for long fans, this requires neighboring triangle about one index per triangle • Can now enumerate • Memory considerations exactly the same as triangle strip triangles around a vertex Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 17 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 18 Triangle neighbor structure Triangle neighbor structure • Extension to indexed • Extension to indexed triangle set triangle set • Triangle points to its three • Triangle points to its three neighboring triangles neighboring triangles • Vertex points to a single • Vertex points to a single neighboring triangle neighboring triangle • Can now enumerate • Can now enumerate triangles around a vertex triangles around a vertex Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 18 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 18 Triangle neighbor structure Triangle neighbor structure Triangle { Triangle neighbor[3]; Vertex vertex[3]; } // t.neighbor[i] is adjacent // across the edge from i to i+1 Vertex { // ... per-vertex data ... Triangle t; // any adjacent tri } // ... or ... Mesh { // ... per-vertex data ... int tInd[nt][3]; // vertex indices int tNbr[nt][3]; // indices of neighbor triangles int vTri[nv]; // index of any adjacent triangle } Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 19 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 20 Triangle neighbor structure Triangle neighbor structure Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 20 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 20 Triangle neighbor structure Triangle neighbor structure Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 20 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 20 Triangle neighbor structure Triangle neighbor structure TrianglesOfVertex(v) { • indexed mesh was 36 bytes per vertex t = v.t; do { • add an array of triples of indices (per triangle) find t.vertex[i] == v; t = t.nbr[pred(i)]; – int[n ][3]: about 24 bytes per vertex } while (t != v.t); T } • 2 triangles per vertex (on average) pred(i) = (i+2) % 3; • (3 indices x 4 bytes) per triangle succ(i) = (i+1) % 3; • add an array of representative triangle per vertex – int[nV]: 4 bytes per vertex • total storage: 64 bytes per vertex – still not as much as separate triangles Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 21 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 22 Triangle neighbor structure—refined Triangle neighbor structure—refined Triangle { Triangle { Edge nbr[3]; Edge nbr[3]; Vertex vertex[3]; Vertex vertex[3]; } } // if t.nbr[i].i == j // if t.nbr[i].i == j // then t.nbr[i].t.nbr[j] == t // then t.nbr[i].t.nbr[j] == t Edge { Edge { // the i-th edge of triangle t // the i-th edge of triangle t Triangle t; Triangle t; int i; // in {0,1,2} int i; // in {0,1,2} // in practice t and i share 32 bits // in practice t and i share 32 bits } } Vertex { Vertex { // ... per-vertex data ... // ... per-vertex data ... Edge e; // any edge leaving vertex Edge e; // any edge leaving vertex } T0.nbr[0] = { T1, 2 } } T0.nbr[0] = { T1, 2 } T1.nbr[2] = { T0, 0 } T1.nbr[2] = { T0, 0 } V0.e = { T1, 0 } V0.e = { T1, 0 } Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 23 Cornell CS4620 Fall 2006 •!Lecture 11 © 2008 Steve Marschner • 23 Triangle neighbor structure Winged-edge mesh TrianglesOfVertex(v) { • Edge-centric rather than {t, i} = v.e; do { face-centric {t, i} = t.nbr[pred(i)]; } while (t != v.t); – therefore also works for } polygon meshes pred(i) = (i+2) % 3; • Each (oriented) edge points to: succ(i) = (i+1) % 3; – left and right forward edges – left and right backward edges – front and back vertices – left and right faces • Each face or vertex points to

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    14 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us