1.2 Surface Representation ! & Data Structures: Hao Li
1.2 Surface Representation ! & Data Structures: Hao Li
Hao Li
http://cs599.hao-li.com
!1
Administrative
!3
Last Time
Geometry Processing
Reconstruction
Rendering
Capture Analysis
Reproduction
Manipulation
!4
Geometric Representations
Surface Representations
!7
Large scenes
!8
Outline
• Parametric Approximations
• Polygonal Meshes
• Data Structures
!9
Parametric Representation
f: IR ⇥ IR ,
2 3
S = f( )
2D example: A Circle
f : [0, 2 ] IR 2
⇥
r cos(t) r
f (t) =
r sin(t)
!10
Parametric Representation
f: IR ⇥ IR ,
2 3
S = f( )
f : [0, 2 ] IR 2
⇥
r cos(t)
?
f (t) =
r sin(t)
?
!11
Piecewise Approximation
f: IR ⇥ IR ,
2 3
S = f( )
f : [0, 2 ] IR 2
⇥
r cos(t)
?
f (t) =
r sin(t)
?
!12
Polynomial Approximation
Polynomials are computable functions
p p
f (t) = ci ti = c̃i i (t)
i=0 i=0
i=0
i!
!13
Polynomial Approximation
Issues!
(p+1)
• smoothness of the target data ( max f (t) )
t
• smothness condition between segments
!14
Polygonal Meshes
3 6 12 24
!16
Polygonal Meshes
!17
Polygonal Meshes
!18
Polygonal Meshes
!19
Polygonal Meshes
!20
Outline
• Parametric Approximations
• Polygonal Meshes
• Data Structures
!21
Graph Definitions
B
A
• Graph {V,E}
E
D F
C
I
H
G
J K
!22
Graph Definitions
B
A
• Graph {V,E}
E
D F • Vertices V = {A,B,C,…,K}
C
I
H
G
J K
!23
Graph Definitions
B
A
• Graph {V,E}
E
D F • Vertices V = {A,B,C,…,K}
C
• Edges E = {(AB),(AE),(CD),…}
I
H
G
J K
!24
Graph Definitions
B
A
• Graph {V,E}
E
D F • Vertices V = {A,B,C,…,K}
C
• Edges E = {(AB),(AE),(CD),…}
I
H • Faces F = {(ABE),(EBF),(EFIH),…}
G
J K
!25
Graph Definitions
B
A
J K
!26
Connectivity
Connected:!
B
A Path of edges connecting
every two vertices
E
D F
C
I
H
G
J K
!27
Connectivity
Connected:!
B Path of edges connecting
A
every two vertices
E !
D F
C Subgraph:!
I Graph {V’,E’} is a subgraph of graph
H
{V,E} if V’ is a subset of V and E’ is a
G
subset of E incident on V’.
J K
!28
Connectivity
Connected:!
B Path of edges connecting
A
every two vertices
E !
D F
C Subgraph:!
I Graph {V’,E’} is a subgraph of graph
H
{V,E} if V’ is a subset of V and E’ is a
G
subset of E incident on V’.
J K
!29
Connectivity
Connected:!
B Path of edges connecting
A
every two vertices
E !
D F
C Subgraph:!
I Graph {V’,E’} is a subgraph of graph
H
{V,E} if V’ is a subset of V and E’ is a
G
subset of E incident on V’.
!
J K
Connected Components:!
Maximally connected subgraph
!30
Connectivity
Connected:!
B Path of edges connecting
A
every two vertices
E !
D F
C Subgraph:!
I Graph {V’,E’} is a subgraph of graph
H
{V,E} if V’ is a subset of V and E’ is a
G
subset of E incident on V’.
!
J K
Connected Components:!
Maximally connected subgraph
!31
Graph Embedding
d
Embedding: Graph is embedded in , if R
d
each vertex is assigned a position in R .
2
Embedding in R Embedding in R 3
!32
Graph Embedding
d
Embedding: Graph is embedded in , if R
d
each vertex is assigned a position in R .
3
Embedding in R
!33
Planar Graph
Planar Graph !
Graph whose vertices and edges can be
2
embedded in R such that its edges do
not intersect
Straight Line !
Planar Graph Plane Graph
Plane Graph
!34
Triangulation
Triangulation:!
B Straight line plane graph where every
A face is a triangle
E
D F Why?!
C
• simple homogenous data structure
I
H • efficient rendering
G
• simplifies algorithms
• by definition, triangle is planar
J K • any polygon can be triangulated
!35
Mesh
!37
While digital artists call it Wireframe, …
!38
Polygonal Mesh
!39
Polygonal Mesh Notation
M = ({vi }, {e j }, { f k })
3
geometry vi R
!40
Polygonal Mesh Notation
M = ({vi }, {e j }, { f k })
3
geometry vi R
3
topology ei , f i R
!41
Global Topology: Genus
!42
Euler Poincaré Formula
!43
Euler Poincaré Formula
V E + F = 2(1 g)
4 6 + 4 = 2(1 0)
!44
Euler Poincaré Formula
V E + F = 2(1 g)
16 32 + 16 = 2(1 1)
!45
Average Valence of Closed Triangle Mesh
!46
Euler Consequences
• E ⇡ 3V
• Average valence = 6
!47
Euler Characteristic
=2 =0 =0 =0
!48
How many pentagons?
!49
How many pentagons?
Non-manifold Examples:
!51
Outline
• Parametric Approximations
• Polygonal Meshes
• Data Structures
!52
Mesh Data Structures
!53
Data Structures
!54
Data Structures
!55
Data Structures
!56
Data Structures
!57
Face Set (STL)
Face:!
Triangles
• 3 vertex positions
x11 y11 z11 x12 y12 z12 x13 y13 z13
!58
Shared Vertex (OBJ,OFF)
...
...
!59
Face-Based Connectivity
Vertex:!
• position
• 1 face
!
Face:!
• 3 vertices
• 3 face neighbors
64 B/v!
!
No edges: Special case
handling for arbitrary
polygons
!60
Edges always have the same !
topological structure
!61
(Winged) Edge-Based Connectivity
Vertex:!
• position
• 1 edge
!
Edge:!
• 2 vertices
• 2 faces
• 4 edges
! 120 B/v
!
Face:! Edges have no orientation:
• 1 edges special case handling for
neighbors
!62
Halfedge-Based Connectivity
Vertex:!
• position
• 1 halfedge
!
Edge:!
• 1 vertex
• 1 face
• 1, 2, or 3 halfedges
96 to 144 B/v!
! !
Edges have orientation: No-
Face:!
runtime overhead due to
• 1 halfedge arbitrary faces
!63
Arbitrary Faces during Modeling
!64
One-Ring Traversal
1. Start at vertex
!65
One-Ring Traversal
1. Start at vertex
2. Outgoing halfedge
!66
One-Ring Traversal
1. Start at vertex
2. Outgoing halfedge
3. Opposite halfedge
!67
One-Ring Traversal
1. Start at vertex
2. Outgoing halfedge
3. Opposite halfedge
4. Next halfedge
!68
One-Ring Traversal
1. Start at vertex
2. Outgoing halfedge
3. Opposite halfedge
4. Next halfedge
5. Opposite
!69
One-Ring Traversal
1. Start at vertex
2. Outgoing halfedge
3. Opposite halfedge
4. Next halfedge
5. Opposite
6. Next
7. …
!70
Halfedge datastructure Libraries
CGAL!
• www.cgal.org
• Computational Geometry
• Free for non-commercial use
!
OpenMesh!
• www.openmesh.org
• Mesh processing
• Free, LGPL license
!71
Why Openmesh?
Flexible / Lightweight!
• Random access to vertices/edges/faces
• Arbitrary scalar types
• Arrays or lists as underlying kernels
!
Easy to Use
!72
Literature
• 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
!73
TODO
!74
Next Time
!75
http://cs599.hao-li.com
Thanks!
!76