1.2 Surface Representation & Data Structures
Total Page:16
File Type:pdf, Size:1020Kb
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 exercise on Jan 24th Siggraph Deadline 2013@ILM! 2 Last Time Geometry Processing Reconstruction Rendering Capture Analysis Reproduction Manipulation 3 Geometric Representations point based quad mesh triangle mesh implicit surfaces / particles volumetric tetrahedrons4 Geometric Representations point based quad mesh triangle mesh Surface Representations implicit surfaces / particles volumetric tetrahedrons5 High Resolution 6 Large scenes 7 Outline • Parametric Approximations • Polygonal Meshes • Data Structures 8 Parametric Representation Surface is the range of a function f : Ω IR 2 IR 3, = f(Ω) ⊂ ⇥ SΩ 2D example: A Circle f : [0, 2π] IR 2 → r cos(t) r f(t)= r sin(t) ⇥ 9 Parametric Representation Surface is the range of a function f : Ω IR 2 IR 3, = f(Ω) ⊂ ⇥ SΩ 2D example: Island coast line f : [0, 2π] IR 2 → r cos(? t) f(t)= r sin(? t) ⇥ 10 Piecewise Approximation Surface is the range of a function f : Ω IR 2 IR 3, = f(Ω) ⊂ ⇥ SΩ 2D example: Island coast line f : [0, 2π] IR 2 → r cos(? t) f(t)= r sin(? t) ⇥ 11 Polynomial Approximation Polynomials are computable functions p p i f(t)= ci t = c˜i φi(t) i=0 i=0 Taylor expansion up to degree p p 1 g(h)= g(i)(0) hi + O hp+1 i! i=0 ⇤ ⇥ Error for approximation g by polynomial f f(t )=g(t ) , 0 t < <t h i i ⇥ 0 ··· p ⇥ p 1 f(t) g(t) max f (p+1) (t t )=O h(p+1) | − | ⇥ (p + 1)! − i i=0 ⇤ ⇥ 12 Polynomial Approximation Approximation error is O(hp+1) Improve approximation quality by • increasing p … higher order polynomials • decreasing h … shorter / more segments Issues (p+1) • smoothness of the target data ( max f ( t ) ) t • smoothness condition between segments 13 Polygonal Meshes Polygonal meshes are a good compromise 2 • Piecewise linear approximation → error is O(h ) 3 6 12 24 25% 6.5% 1.7% 0.4% 14 Polygonal Meshes Polygonal meshes are a good compromise 2 • Piecewise linear approximation → error is O(h ) • Error inversely proportional to #faces 15 Polygonal Meshes Polygonal meshes are a good compromise 2 • Piecewise linear approximation → error is O(h ) • Error inversely proportional to #faces • Arbitrary topology surfaces 16 Polygonal Meshes Polygonal meshes are a good compromise 2 • Piecewise linear approximation → error is O(h ) • Error inversely proportional to #faces • Arbitrary topology surfaces • Piecewise smooth surfaces 17 Polygonal Meshes Polygonal meshes are a good compromise 2 • Piecewise linear approximation → error is O(h ) • Error inversely proportional to #faces • Arbitrary topology surfaces • Piecewise smooth surfaces • Adaptive sampling 18 Polygonal Meshes Polygonal meshes are a good compromise 2 • Piecewise linear approximation → error is O(h ) • Error inversely proportional to #faces • Arbitrary topology surfaces • Piecewise smooth surfaces • Adaptive sampling • Efficient GPU-based rendering/processing 19 Outline • Parametric Approximations • Polygonal Meshes • Data Structures 20 Graph Definitions B A • Graph {V,E} E D F C I H G J K 21 Graph Definitions B A • Graph {V,E} E D F • Vertices V = {A,B,C,…,K} C I H G J K 22 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 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 • Faces F = {(ABE),(EBF),(EFIH),…} G J K 24 Graph Definitions B A E Vertex degree or valence: D F C number of incident edges I • deg(A) = 4 H • deg(E) = 5 G J K 25 Connectivity Connected: B A Path of edges connecting every two vertices E D F C I H G J K 26 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 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’. K J Connected Components: Maximally connected subgraph 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’. K J Connected Components: Maximally connected subgraph 30 Graph Embedding d Embedding: Graph is embedded in R , if d each vertex is assigned a position in R . 2 3 Embedding in R Embedding in R 31 Graph Embedding d Embedding: Graph is embedded in R , if d each vertex is assigned a position in R . 3 Embedding in R 32 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 33 Triangulation Triangulation: B Straight line plane graph where every A face is a triangle E D F C Why? • simple homogenous data structure I H • efficient rendering G • simplifies algorithms • by definition, triangle is planar K J • any polygon can be triangulated 34 Mesh • Mesh: straight-line graph 3 embedded in R • 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 35 Polygon A geometric graph Q =(V,E) d with V = p 0 , p 1 ,..., p n 1 in R , d 2 { − } ≥ and E = (p0, p1) ...(pn 2, pn 1) { − − } is called a polygon A polygon is called • flat, if all edges are on a plane • closed, if p0 = pn 1 − 36 While digital artists call it Wireframe, … 37 Polygonal Mesh A set M of finite number of closed polygons Q i if: • Intersection of inner polygonal areas is empty • Intersection of 2 polygons from M is either empty, a point p P or an edge e E 2 2 • Every edge e E belongs to at least one polygon 2 • 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 38 Polygonal Mesh Notation = ( v , e , f ) M { i} { j} { k} geometry v R3 i ∈ 39 Polygonal Mesh Notation = ( v , e , f ) M { i} { j} { k} geometry v R3 i ∈ topology e , f R3 i i ⊂ 40 Global Topology: Genus • 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 41 Euler Poincaré Formula • For a closed polygonal mesh of genus g , the relation of the number V of vertices, E of edges, and F of faces is given by Euler’s formula: V E + F = 2(1 g) − − • The term 2(1 g ) is called the Euler characteristic χ − 42 Euler Poincaré Formula V E + F = 2(1 g) − − 4 6 + 4 = 2(1 0) − − 43 Euler Poincaré Formula V E + F = 2(1 g) − − 16 32 + 16 = 2(1 1) − − 44 Average Valence of Closed Triangle Mesh 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 45 Euler Consequences Triangle mesh statistics • F 2V ⇡ • E 3V ⇡ • Average valence = 6 Quad mesh statistics • F V ⇡ • E 2V ⇡ • Average valence = 4 46 Euler Characteristic Sphere Torus Moebius Strip Klein Bottle χ =2 χ =0 χ =0 χ =0 47 How many pentagons? 48 How many pentagons? Any closed surface of genus 0 consisting only of hexagons and pentagons and where every vertex has valence 3 must have exactly 12 pentagons 49 Two-Manifold Surfaces Local neighborhoods are disk-shaped f(D✏[u, v]) = Dδ[f(u, v)] Guarantees meaningful neighbor enumeration • required by most algorithms Non-manifold Examples: 50 Outline • Parametric Approximations • Polygonal Meshes • Data Structures 51 Mesh Data Structures • 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 52 Data Structures What should be stored? • Geometry: 3D vertex coordinates • Connectivity: Vertex adjacency • Attributes: • normals, color, texture coordinates, etc. • Per Vertex, per face, per edge 53 Data Structures 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 54 Data Structures 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 55 Data Structures 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 56 Face Set (STL) Face: Triangles • 3 vertex positions x11 y11 z11 x12 y12 z12 x13 y13 z13 x21 y21 z21 x22 y22 z22 x23 y23 z23 ..