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 2017 CSCI 621: Digital Geometry Processing 1.2 Surface Representation & Data Structures Hao Li http://cs621.hao-li.com 1 Administrative No class next Tuesday, due to Siggraph deadline Introduction to first programming


slide-1
SLIDE 1

CSCI 621: Digital Geometry Processing

Hao Li

http://cs621.hao-li.com

1

Spring 2017

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 on Jan

24th

Siggraph Deadline 2013@ILM!

slide-3
SLIDE 3

Last Time

3

Reconstruction Geometry Processing Capture Analysis Manipulation Rendering Reproduction

slide-4
SLIDE 4

Geometric Representations

4

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

slide-5
SLIDE 5

Geometric Representations

5

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

Surface Representations

slide-6
SLIDE 6

High Resolution

6

slide-7
SLIDE 7

Large scenes

7

slide-8
SLIDE 8

Outline

8

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

Parametric Representation

9

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-10
SLIDE 10

Parametric Representation

10

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-11
SLIDE 11

Piecewise Approximation

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

Polynomial Approximation

12

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-13
SLIDE 13

Polynomial Approximation

13

Improve approximation quality by

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

Issues

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

Approximation error is O(hp+1)

h p max

t

f (p+1)(t)

slide-14
SLIDE 14

Polygonal Meshes

14

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-15
SLIDE 15

Polygonal Meshes

15

Polygonal meshes are a good compromise

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

O(h2)

slide-16
SLIDE 16

Polygonal Meshes

16

Polygonal meshes are a good compromise

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

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
  • Piecewise smooth 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
  • Adaptive sampling

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
  • Efficient GPU-based rendering/processing

O(h2)

slide-20
SLIDE 20

Outline

20

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

Graph Definitions

21

A B C D E F G H I J K

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

22

A B C D E F G H I J K

Graph Definitions

  • Graph {V,E}
  • Vertices V = {A,B,C,…,K}
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}
  • Edges E = {(AB),(AE),(CD),…}
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),…}
  • Faces F = {(ABE),(EBF),(EFIH),…}
slide-25
SLIDE 25

25

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-26
SLIDE 26

26

A B C D E F G H I J K

Connectivity

Connected:

Path of edges connecting every two vertices

slide-27
SLIDE 27

Connectivity

27

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-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’.

Connected Components:

Maximally connected subgraph

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

Graph Embedding

31

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

Embedding in Embedding in

Rd Rd R2 R3

slide-32
SLIDE 32

Graph Embedding

32

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

Embedding in R3

Rd Rd

slide-33
SLIDE 33

33

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-34
SLIDE 34

Triangulation

34

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-35
SLIDE 35

Mesh

35

  • 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-36
SLIDE 36

Polygon

36

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-37
SLIDE 37

While digital artists call it Wireframe, …

37

slide-38
SLIDE 38

Polygonal Mesh

38

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-39
SLIDE 39

Polygonal Mesh Notation

39

vi ∈ R3

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

geometry

slide-40
SLIDE 40

Polygonal Mesh Notation

40

ei, fi ⊂ R3 topology vi ∈ R3

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

geometry

slide-41
SLIDE 41

Global Topology: Genus

41

  • 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-42
SLIDE 42

Euler Poincaré Formula

42

  • 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-43
SLIDE 43

Euler Poincaré Formula

43

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

slide-44
SLIDE 44

Euler Poincaré Formula

44

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

slide-45
SLIDE 45

Average Valence of Closed Triangle Mesh

45

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)/V ~6 for large V

slide-46
SLIDE 46

Euler Consequences

46

Triangle mesh statistics

  • Average valence = 6

Quad mesh statistics

  • Average valence = 4

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

slide-47
SLIDE 47

Euler Characteristic

47

Sphere Torus Moebius Strip Klein Bottle

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

slide-48
SLIDE 48

How many pentagons?

48

slide-49
SLIDE 49

How many pentagons?

49

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-50
SLIDE 50

Two-Manifold Surfaces

50

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-51
SLIDE 51

Outline

51

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

Mesh Data Structures

52

  • 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-53
SLIDE 53

Data Structures

53

What should be stored?

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

Data Structures

54

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-55
SLIDE 55

Data Structures

55

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-56
SLIDE 56

Data Structures

56

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-57
SLIDE 57

Face Set (STL)

57

Triangles x11 y11 z11 x12 y12 z12 x13 y13 z13 x21 y21 z21 x22 y22 z22 x23 y23 z23 ... ... ... xF1 yF1 zF1 xF2 yF2 zF2 xF3 yF3 zF3

Face:

  • 3 vertex positions

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

slide-58
SLIDE 58

Shared Vertex (OBJ,OFF)

58

Vertices x1 y1 z1 ... xV yV zV Triangles i11 i12 i13 ... ... ... ... iF1 iF2 iF3

12 B/v + 12 B/f = 36B/v No explicit adjacency info

Indexed Face List:

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

Face-Based Connectivity

59

64 B/v No edges: Special case handling for arbitrary polygons

Vertex:

  • position
  • 1 face

Face:

  • 3 vertices
  • 3 face neighbors
slide-60
SLIDE 60

Edges always have the same topological structure

60

Efficient handling of polygons with variable valence

slide-61
SLIDE 61

(Winged) Edge-Based Connectivity

61

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-62
SLIDE 62

Halfedge-Based Connectivity

62

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-63
SLIDE 63

Arbitrary Faces during Modeling

63

slide-64
SLIDE 64

One-Ring Traversal

64

  • 1. Start at vertex
slide-65
SLIDE 65

One-Ring Traversal

65

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

One-Ring Traversal

66

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

One-Ring Traversal

67

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

One-Ring Traversal

68

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

One-Ring Traversal

69

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

Halfedge datastructure Libraries

70

CGAL

  • www.cgal.org
  • Computational Geometry
  • Free for non-commercial use

OpenMesh

  • www.openmesh.org
  • Mesh processing
  • Free, LGPL license
slide-71
SLIDE 71

Why Openmesh?

71

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-72
SLIDE 72

Literature

72

  • 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-73
SLIDE 73

TODO

73

Learn the terms and notations

slide-74
SLIDE 74

Next Next Time

74

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

http://cs621.hao-li.com

Thanks!

75