Surfaces/Meshes We’ll stick to triangles Working with Meshes CS 176 Winter 2011 CS 176 Winter 2011 1 2 Discrete Surfaces What’s a Mesh? Setup Formally “pointers” “floats” topology & geometry abstract simplicial complex K singletons, pairs, triples,… of integers simplicial complex: “triangle mesh” 2-manifold if ld abstract simplices containment property Euler characteristic partial order ¹ , face, coface, ∅ CS 176 Winter 2011 CS 176 Winter 2011 3 4 Simplicial Complex Topological Structure Topological realization 2-manifold (with boundary) identify V with unit vectors in R N every point has an open, (half-) disklike subset surrounding it complex convex hull of vertex images make subc subset topology of ambient space b l b closure, star, and link incidence |K| 2-manifold iff |St v| ≈ R 2 “1-ring” CS 176 Winter 2011 CS 176 Winter 2011 5 6
Topological Invariants Simplicial Complex Euler characteristic Geometric realization for surfaces: F-E+V= =2(g-1) the concrete embedding v (|K|) not required to be simplicial more generally for simplicial ll f i li i l vertex images specify everything t i if thi complexes piecewise linear approximation proof by presumably approximation of induction (shelling) underlying smooth surface CS 176 Winter 2011 CS 176 Winter 2011 7 8 Mesh Structure Building the Mesh Input What do we need? x1 y1 z1 … x2 y2 z2 … typically array of pointers to vertices x3 y3 z3 … … list of vertices (how long?) i j k choices for basic topology primitive j k l list of triangles (until EOF) li t f t i l ( til EOF) … (half-)edges (h lf ) d need to build mesh structure different variants triangles infer topology check topology we’ll use triangles oriented (orientable?) CS 176 Winter 2011 CS 176 Winter 2011 9 10 Types of Operations Types of Operations What do we need to support? What do we need to support? iterate over all vertices (easy) for a vertex visit iterate over all triangles (easy) star link li k for a triangle visit l different flavors incident vertices (easy) need back pointer incident triangles (easy) vertex points to one incident triangle careful at boundary! CS 176 Winter 2011 CS 176 Winter 2011 11 12
Types of Operations Operations to Support What about edges? For later (think about it now…) visit all edges edge collapse not explicitly represented… legality? do we need edges? Yes! d d d ? Y ! edge flip d fli discover triangle adjacencies map pairs of integers to triangles CS 176 Winter 2011 CS 176 Winter 2011 13 14 Data Structures What Data Where? Triangles Attributes consistent ordering of vertex and normal, color, texture coordinates triangle incidences later: forces, velocities, mass why not just lay everything out in h t j t l thi t i Triangle{ Vertex *v[3]; arrays? Triangle *t[3]; changes in structure! } very hard to debug… triangles across from vertices CS 176 Winter 2011 CS 176 Winter 2011 15 16 Examples Example Vertex normals Gaussian curvature gradient of volume CS 176 Winter 2011 CS 176 Winter 2011 17 18
Principles Other Tricks As you write code… As you write code assumptions are ok, but you must use two sided lighting assert them explicitly abstract the iterators! orientability orientability what about boundary vertices? h b b d i 2-manifold property keep iterators sorted avoid storing the same information interior then boundary vertices multiple times interior then boundary triangles nasty to keep current under changes CS 176 Winter 2011 CS 176 Winter 2011 19 20
Recommend
More recommend