Surfaces/Meshes Well stick to triangles Working with Meshes CS 176 - - PDF document

surfaces meshes
SMART_READER_LITE
LIVE PREVIEW

Surfaces/Meshes Well stick to triangles Working with Meshes CS 176 - - PDF document

Surfaces/Meshes Well stick to triangles Working with Meshes CS 176 Winter 2011 CS 176 Winter 2011 1 2 Discrete Surfaces Whats a Mesh? Setup Formally pointers floats topology & geometry abstract simplicial


slide-1
SLIDE 1

Working with Meshes

CS 176 Winter 2011

1

Surfaces/Meshes

We’ll stick to triangles

CS 176 Winter 2011

2

Discrete Surfaces

Setup

 topology & geometry  simplicial complex: “triangle mesh”

if ld

“pointers” “floats”

CS 176 Winter 2011

3

 2-manifold  Euler characteristic

What’s a Mesh?

Formally

 abstract simplicial complex K

 singletons, pairs, triples,… of integers

CS 176 Winter 2011

4

 containment property  partial order ¹ , face, coface, ∅

abstract simplices

Simplicial Complex

Topological realization

 identify V with unit vectors in RN

b l b

convex hull of vertex images

complex

CS 176 Winter 2011

5

 subset topology of ambient space  closure, star, and link

make subc incidence

“1-ring”

Topological Structure

2-manifold (with boundary)

 every point has an open, (half-)

disklike subset surrounding it

CS 176 Winter 2011

6

 |K| 2-manifold iff |St v| ≈ R2

slide-2
SLIDE 2

Topological Invariants

Euler characteristic

 for surfaces: F-E+V==2(g-1)

 not required to be simplicial

ll f i li i l

CS 176 Winter 2011

7

 more generally for simplicial

complexes

 proof by

induction (shelling)

Simplicial Complex

Geometric realization

 the concrete embedding v(|K|)

t i if thi

CS 176 Winter 2011

8

 vertex images specify everything  piecewise linear approximation  presumably approximation of

underlying smooth surface

Mesh Structure

Input

 typically

 list of vertices (how long?)

li t f t i l ( til EOF)

x1 y1 z1 … x2 y2 z2 … x3 y3 z3 … … i j k j k l

CS 176 Winter 2011

9

 list of triangles (until EOF)

 need to build mesh structure

 infer topology  check topology  oriented (orientable?)

Building the Mesh

What do we need?

 array of pointers to vertices  choices for basic topology primitive

(h lf ) d

CS 176 Winter 2011

10

 (half-)edges

 different variants

 triangles

 we’ll use triangles

Types of Operations

What do we need to support?

 iterate over all vertices (easy)  iterate over all triangles (easy)

l

CS 176 Winter 2011

11

 for a triangle visit

 incident vertices (easy)  incident triangles (easy)

Types of Operations

What do we need to support?

 for a vertex visit

 star

li k

CS 176 Winter 2011

12

 link  different flavors

 need back pointer

 vertex points to one incident triangle  careful at boundary!

slide-3
SLIDE 3

Types of Operations

What about edges?

 visit all edges

 not explicitly represented…

d d d ? Y !

CS 176 Winter 2011

13

 do we need edges? Yes!

 discover triangle adjacencies  map pairs of integers to triangles

Operations to Support

For later (think about it now…)

 edge collapse

 legality?

d fli

CS 176 Winter 2011

14

 edge flip

Data Structures

Triangles

 consistent ordering of vertex and

triangle incidences

CS 176 Winter 2011

15

 triangles across from vertices

Triangle{ Vertex *v[3]; Triangle *t[3]; }

What Data Where?

Attributes

 normal, color, texture coordinates

 later: forces, velocities, mass

h t j t l thi t i

CS 176 Winter 2011

16

 why not just lay everything out in

arrays?

 changes in structure!  very hard to debug…

Examples

Vertex normals

 gradient of volume

CS 176 Winter 2011

17

Example

Gaussian curvature

CS 176 Winter 2011

18

slide-4
SLIDE 4

Principles

As you write code…

 assumptions are ok, but you must

assert them explicitly

 orientability

CS 176 Winter 2011

19

 orientability  2-manifold property

 avoid storing the same information

multiple times

 nasty to keep current under changes

Other Tricks

As you write code

 use two sided lighting  abstract the iterators!

h b b d i

CS 176 Winter 2011

20

 what about boundary vertices?

 keep iterators sorted

 interior then boundary vertices  interior then boundary triangles