1.2 Surface Representation & Data Structures Hao Li - - PowerPoint PPT Presentation

1 2 surface representation data structures
SMART_READER_LITE
LIVE PREVIEW

1.2 Surface Representation & Data Structures Hao Li - - PowerPoint PPT Presentation

Spring 2015 CSCI 599: Digital Geometry Processing 1.2 Surface Representation & Data Structures Hao Li http://cs599.hao-li.com 1 Administrative No class next Tuesday, due to Siggraph deadline Introduction to first programming


slide-1
SLIDE 1

CSCI 599: Digital Geometry Processing

Hao Li

http://cs599.hao-li.com

1

Spring 2015

1.2 Surface Representation & Data Structures

slide-2
SLIDE 2

Administrative

2

  • No class next Tuesday, due to Siggraph deadline
  • Introduction to first programming exercise next

Thursday

Siggraph Deadline 2013@ILM, Ewww!

slide-3
SLIDE 3

After Siggraph Deadline @ILM

3

slide-4
SLIDE 4

Last Time

4

Reconstruction Geometry Processing Capture Analysis Manipulation Rendering Reproduction

slide-5
SLIDE 5

Geometric Representations

5

implicit surfaces / particles volumetric tetrahedrons point based quad mesh triangle mesh

slide-6
SLIDE 6

Geometric Representations

6

implicit surfaces / particles volumetric tetrahedrons point based quad mesh triangle mesh

Surface Representations

slide-7
SLIDE 7

High Resolution

7

slide-8
SLIDE 8

Large scenes

8

slide-9
SLIDE 9

Outline

9

  • Parametric Approximations
  • Polygonal Meshes
  • Data Structures
slide-10
SLIDE 10

Parametric Representation

10

r

f : Ω ⊂ IR2 → IR3, SΩ = f(Ω) f : [0, 2π] → IR2 f(t) =

  • r cos(t)

r sin(t) ⇥

Surface is the range of a function 2D example: A Circle

slide-11
SLIDE 11

Parametric Representation

11

f : Ω ⊂ IR2 → IR3, SΩ = f(Ω) f : [0, 2π] → IR2 f(t) =

  • r cos(t)

r sin(t) ⇥

Surface is the range of a function 2D example: Island coast line ? ?

slide-12
SLIDE 12

Piecewise Approximation

12

f : Ω ⊂ IR2 → IR3, SΩ = f(Ω) f : [0, 2π] → IR2 f(t) =

  • r cos(t)

r sin(t) ⇥

Surface is the range of a function 2D example: Island coast line ? ?

slide-13
SLIDE 13

Polynomial Approximation

13

f(t) =

p

  • i=0

ci ti =

p

  • i=0

˜ ci φi(t) f(ti) = g(ti) , 0 ≤ t0 < · · · < tp ≤ h |f(t) − g(t)| ≤ 1 (p + 1)! max f (p+1)

p

i=0

(t − ti) = O

  • h(p+1)⇥

g(h) =

p

i=0

1 i! g(i)(0) hi + O

  • hp+1⇥

Polynomials are computable functions Taylor expansion up to degree Error for approximation by polynomial

p g f

slide-14
SLIDE 14

Polynomial Approximation

14

Improve approximation quality by

  • increasing … higher order polynomials
  • decreasing … shorter / more segments

Issues

  • smoothness of the target data ( )
  • smothness condition between segments

Approximation error is O(hp+1)

h p max

t

f (p+1)(t)

slide-15
SLIDE 15

Polygonal Meshes

15

3 6 12 24

Polygonal meshes are a good compromise

  • Piecewise linear approximation → error is O(h2)

25% 6.5% 1.7% 0.4%

slide-16
SLIDE 16

Polygonal Meshes

16

Polygonal meshes are a good compromise

  • Piecewise linear approximation → error is
  • Error inversely proportional to #faces

O(h2)

slide-17
SLIDE 17

Polygonal Meshes

17

Polygonal meshes are a good compromise

  • Piecewise linear approximation → error is
  • Error inversely proportional to #faces
  • Arbitrary topology surfaces

O(h2)

slide-18
SLIDE 18

Polygonal Meshes

18

Polygonal meshes are a good compromise

  • Piecewise linear approximation → error is
  • Error inversely proportional to #faces
  • Arbitrary topology surfaces
  • Piecewise smooth surfaces

O(h2)

slide-19
SLIDE 19

Polygonal Meshes

19

Polygonal meshes are a good compromise

  • Piecewise linear approximation → error is
  • Error inversely proportional to #faces
  • Arbitrary topology surfaces
  • Piecewise smooth surfaces
  • Adaptive sampling

O(h2)

slide-20
SLIDE 20

Polygonal Meshes

20

Polygonal meshes are a good compromise

  • Piecewise linear approximation → error is
  • Error inversely proportional to #faces
  • Arbitrary topology surfaces
  • Piecewise smooth surfaces
  • Adaptive sampling
  • Efficient GPU-based rendering/processing

O(h2)

slide-21
SLIDE 21

Outline

21

  • Parametric Approximations
  • Polygonal Meshes
  • Data Structures
slide-22
SLIDE 22

Graph Definitions

22

A B C D E F G H I J K

  • Graph {V,E}
slide-23
SLIDE 23

23

A B C D E F G H I J K

Graph Definitions

  • Graph {V,E}
  • Vertices V = {A,B,C,…,K}
slide-24
SLIDE 24

24

A B C D E F G H I J K

Graph Definitions

  • Graph {V,E}
  • Vertices V = {A,B,C,…,K}
  • Edges E = {(AB),(AE),(CD),…}
slide-25
SLIDE 25

25

A B C D E F G H I J K

Graph Definitions

  • Graph {V,E}
  • Vertices V = {A,B,C,…,K}
  • Edges E = {(AB),(AE),(CD),…}
  • Faces F = {(ABE),(EBF),(EFIH),…}
slide-26
SLIDE 26

26

A B C D E F G H I J K

Graph Definitions

Vertex degree or valence: number of incident edges

  • deg(A) = 4
  • deg(E) = 5
slide-27
SLIDE 27

27

A B C D E F G H I J K

Connectivity

Connected:

Path of edges connecting every two vertices

slide-28
SLIDE 28

Connectivity

28

A B C D E F G H I J K

Connected:

Path of edges connecting every two vertices

  • Subgraph:

Graph {V’,E’} is a subgraph of graph {V,E} if V’ is a subset of V and E’ is a subset of E incident on V’.

slide-29
SLIDE 29

Connectivity

29

A B C D E F G H I J K

Connected:

Path of edges connecting every two vertices

  • Subgraph:

Graph {V’,E’} is a subgraph of graph {V,E} if V’ is a subset of V and E’ is a subset of E incident on V’.

slide-30
SLIDE 30

Connectivity

30

A B C D E F G H I J K

Connected:

Path of edges connecting every two vertices

  • Subgraph:

Graph {V’,E’} is a subgraph of graph {V,E} if V’ is a subset of V and E’ is a subset of E incident on V’.

  • Connected Components:

Maximally connected subgraph

slide-31
SLIDE 31

Connectivity

31

A B C D E F G H I J K

Connected:

Path of edges connecting every two vertices

  • Subgraph:

Graph {V’,E’} is a subgraph of graph {V,E} if V’ is a subset of V and E’ is a subset of E incident on V’.

  • Connected Components:

Maximally connected subgraph

slide-32
SLIDE 32

Graph Embedding

32

Embedding: Graph is embedded in , if each vertex is assigned a position in .

Embedding in Embedding in

Rd Rd R2 R3

slide-33
SLIDE 33

Graph Embedding

33

Embedding: Graph is embedded in , if each vertex is assigned a position in .

Embedding in R3

Rd Rd

slide-34
SLIDE 34

34

Planar Graph

Planar Graph

Graph whose vertices and edges can be embedded in such that its edges do not intersect

Planar Graph Plane Graph Straight Line Plane Graph

R2

slide-35
SLIDE 35

Triangulation

35

A B C D E F G H I J K

Triangulation:

Straight line plane graph where every face is a triangle

Why?

  • simple homogenous data structure
  • efficient rendering
  • simplifies algorithms
  • by definition, triangle is planar
  • any polygon can be triangulated
slide-36
SLIDE 36

Mesh

36

  • Mesh: straight-line graph

embedded in

  • Boundary edge: adjacent to

exactly 1 face

  • Regular edge: adjacent to

exactly 2 faces

  • Singular edge: adjacent to

more than 2 faces

  • Closed mesh: mesh with no

boundary edges

R3

slide-37
SLIDE 37

Polygon

37

A geometric graph with in , and is called a polygon

  • A polygon is called
  • flat, if all edges are on a plane
  • closed, if

Q = (V, E) V = {p0, p1, . . . , pn−1} Rd d ≥ 2 E = {(p0, p1) . . . (pn−2, pn−1)} p0 = pn−1

slide-38
SLIDE 38

While digital artists call it Wireframe, …

38

slide-39
SLIDE 39

Polygonal Mesh

39

A set of finite number of closed polygons if:

  • Intersection of inner polygonal areas is empty
  • Intersection of 2 polygons from is either empty, a point
  • r an edge
  • Every edge belongs to at least one polygon
  • The set of all edges which belong only to one polygon are

called edges of the polygonal mesh and are either empty or form a single closed polygon

M Qi M e ∈ E p ∈ P e ∈ E

slide-40
SLIDE 40

Polygonal Mesh Notation

40

vi ∈ R3

M = ({vi}, {ej}, { fk})

geometry

slide-41
SLIDE 41

Polygonal Mesh Notation

41

ei, fi ⊂ R3 topology vi ∈ R3

M = ({vi}, {ej}, { fk})

geometry

slide-42
SLIDE 42

Global Topology: Genus

42

  • Genus: Maximal number of closed simple cutting

curves that do not disconnect the graph into multiple components.

  • Or half the maximal number of closed paths that do

no disconnect the mesh

  • Informally, the number of holes or handles

Genus 0 Genus 1 Genus 2 Genus 3

slide-43
SLIDE 43

Euler Poincaré Formula

43

  • For a closed polygonal mesh of genus , the relation
  • f the number of vertices, of edges, and of faces

is given by Euler’s formula:

  • The term is called the Euler characteristic

g V E F V − E + F = 2(1 − g) 2(1 − g) χ

slide-44
SLIDE 44

Euler Poincaré Formula

44

V − E + F = 2(1 − g) 4 − 6 + 4 = 2(1 − 0)

slide-45
SLIDE 45

Euler Poincaré Formula

45

16 − 32 + 16 = 2(1 − 1) V − E + F = 2(1 − g)

slide-46
SLIDE 46

Average Valence of Closed Triangle Mesh

46

Theorem: Average vertex degree in a closed manifold triangle mesh is ~6 Proof: Each face has 3 edges and each edge is counted twice: 3F = 2E

  • by Euler’s formula: V+F-E = V+2E/3-E = 2-2g

Thus E = 3(V-2+2g)

  • So average degree = 2E/V = 6(V-2+2g) ~6 for large V
slide-47
SLIDE 47

Euler Consequences

47

Triangle mesh statistics

  • Average valence = 6

Quad mesh statistics

  • Average valence = 4

F ≈ 2V E ≈ 3V F ≈ V E ≈ 2V

slide-48
SLIDE 48

Euler Characteristic

48

Sphere Torus Moebius Strip Klein Bottle

χ = 2 χ = 0 χ = 0 χ = 0

slide-49
SLIDE 49

How many pentagons?

49

slide-50
SLIDE 50

How many pentagons?

50

Any closed surface of genus 0 consisting only of hexagons and pentagons and where every vertex has valence 3 must have exactly 12 pentagons

slide-51
SLIDE 51

Two-Manifold Surfaces

51

Local neighborhoods are disk-shaped

  • Guarantees meaningful neighbor enumeration
  • required by most algorithms
  • Non-manifold Examples:

f(D✏[u, v]) = D[f(u, v)]

slide-52
SLIDE 52

Outline

52

  • Parametric Approximations
  • Polygonal Meshes
  • Data Structures
slide-53
SLIDE 53

Mesh Data Structures

53

  • How to store geometry & connectivity?
  • compact storage and file formats
  • Efficient algorithms on meshes
  • Time-critical operations
  • All vertices/edges of a face
  • All incident vertices/edges/faces of a vertex
slide-54
SLIDE 54

Data Structures

54

What should be stored?

  • Geometry: 3D vertex coordinates
  • Connectivity: Vertex adjacency
  • Attributes:
  • normals, color, texture coordinates, etc.
  • Per Vertex, per face, per edge
slide-55
SLIDE 55

Data Structures

55

What should it support?

  • Rendering
  • Queries
  • What are the vertices of face #3?
  • Is vertex #6 adjacent to vertex #12?
  • Which faces are adjacent to face #7?
  • Modifications
  • Remove/add a vertex/face
  • Vertex split, edge collapse
slide-56
SLIDE 56

Data Structures

56

Different Data Structures:

  • Time to construct (preprocessing)
  • Time to answer a query
  • Random access to vertices/edges/faces
  • Fast mesh traversal
  • Fast Neighborhood query
  • Time to perform an operation
  • split/merge
  • Space complexity
  • Redundancy
slide-57
SLIDE 57

Data Structures

57

Different Data Structures:

  • Different topological data storage
  • Most important ones are face and edge-based

(since they encode connectivity)

  • Design decision ~ memory/speed trade-off
slide-58
SLIDE 58

Face Set (STL)

58

Triangles x x x x x x ... ... ... x x x

Face:

  • 3 vertex positions

9*4 = 36 B/f (single precision) 72 B/v (Euler Poincaré)

  • No explicit connectivity
slide-59
SLIDE 59

Shared Vertex (OBJ,OFF)

59

Vertices x ... x Triangles i ... ... ... ... i

12 B/v + 12 B/f = 36B/v

  • No explicit adjacency info

Indexed Face List:

  • Vertex: position
  • Face: Vertex Indices
slide-60
SLIDE 60

Face-Based Connectivity

60

64 B/v

  • No edges: Special case

handling for arbitrary polygons

Vertex:

  • position
  • 1 face
  • Face:
  • 3 vertices
  • 3 face neighbors
slide-61
SLIDE 61

Edges always have the same topological structure

61

Efficient handling of polygons with variable valence

slide-62
SLIDE 62

(Winged) Edge-Based Connectivity

62

Vertex:

  • position
  • 1 edge
  • Edge:
  • 2 vertices
  • 2 faces
  • 4 edges
  • Face:
  • 1 edges

120 B/v

  • Edges have no orientation:

special case handling for neighbors

slide-63
SLIDE 63

Halfedge-Based Connectivity

63

96 to 144 B/v

  • Edges have orientation: No-

runtime overhead due to arbitrary faces

Vertex:

  • position
  • 1 halfedge
  • Edge:
  • 1 vertex
  • 1 face
  • 1, 2, or 3 halfedges
  • Face:
  • 1 halfedge
slide-64
SLIDE 64

Arbitrary Faces during Modeling

64

slide-65
SLIDE 65

One-Ring Traversal

65

  • 1. Start at vertex
slide-66
SLIDE 66

One-Ring Traversal

66

  • 1. Start at vertex
  • 2. Outgoing halfedge
slide-67
SLIDE 67

One-Ring Traversal

67

  • 1. Start at vertex
  • 2. Outgoing halfedge
  • 3. Opposite halfedge
slide-68
SLIDE 68

One-Ring Traversal

68

  • 1. Start at vertex
  • 2. Outgoing halfedge
  • 3. Opposite halfedge
  • 4. Next halfedge
slide-69
SLIDE 69

One-Ring Traversal

69

  • 1. Start at vertex
  • 2. Outgoing halfedge
  • 3. Opposite halfedge
  • 4. Next halfedge
  • 5. Opposite
slide-70
SLIDE 70

One-Ring Traversal

70

  • 1. Start at vertex
  • 2. Outgoing halfedge
  • 3. Opposite halfedge
  • 4. Next halfedge
  • 5. Opposite
  • 6. Next
  • 7. …
slide-71
SLIDE 71

Halfedge datastructure Libraries

71

CGAL

  • www.cgal.org
  • Computational Geometry
  • Free for non-commercial use
  • OpenMesh
  • www.openmesh.org
  • Mesh processing
  • Free, LGPL license
slide-72
SLIDE 72

Why Openmesh?

72

Flexible / Lightweight

  • Random access to vertices/edges/faces
  • Arbitrary scalar types
  • Arrays or lists as underlying kernels
  • Efficient in space and time
  • Dynamic memory management for array-based

meshes (not in CGAL)

  • Extendable to specialized kernels for non-manifold

meshes (not in CGAL)

  • Easy to Use
slide-73
SLIDE 73

Literature

73

  • Textbook: Chapter
  • http://www.openmesh.org
  • Kettner, Using generic programming for designing a data structure

for polyhedral surfaces, Symp. on Comp. Geom., 1998

  • Campagna et al., Directed Edges - A Scalable Representation for

Triangle Meshes, Journal of Graphics Tools 4(3), 1998

  • Botsch et al., OpenMesh - A generic and efficient polygon mesh data

structure, OpenSG Symp. 2002

slide-74
SLIDE 74

TODO

74

Learn the terms and notations

slide-75
SLIDE 75

Next Time

75

  • Explicit & Implicit Surfaces
  • Exercise 1: Getting Started with Mesh Processing
slide-76
SLIDE 76

http://cs599.hao-li.com

Thanks!

76