Mesh Data Structure
description
Transcript of Mesh Data Structure
![Page 1: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/1.jpg)
Mesh Data Structure
![Page 2: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/2.jpg)
Meshes
Boundary edge: adjacent to 1 faceRegular edge: adjacent to 2 facesSingular edge: adjacent to >2 faces
Mesh: straight-line graph embedded in R3
Closed mesh: mesh with no boundary edgesManifold mesh: mesh with no singular edges
Corners V x F⊆Half-edges E x ⊆F
![Page 3: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/3.jpg)
• What should be stored?– Geometry: 3D coordinates– Connectivity• Adjacency relationships
– Attributes• e.g. normal, color, texture coordinate• Per vertex, per face, per edge, per corner
Data Structures
![Page 4: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/4.jpg)
Data Structures
• What should it support?– Rendering– Geometry queries• What are the vertices of face #2?• Is vertex A adjacent to vertex H ?• Which faces are adjacent to face #1?
– Modifications• Remove/add a vertex/face• Vertex split, edge collapse
![Page 5: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/5.jpg)
Data Structures
• How good is a data structure?– Time to construct (preprocessing)– Time to answer a query– Time to perform an operation– Space complexity– Redundancy
![Page 6: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/6.jpg)
Mesh Data Structures
• Adjacency-blind schemes– Independent faces– Shared vertex
• Adjacency-aware schemes– Adjacency lists
• Face based connectivity• Edge based connectivity• Half edge
– Adjacency matrix– Corner table
![Page 7: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/7.jpg)
Independent Faces
• Pros– Simple– STL file
• Cons– No connectivity not for topological queries– Redundancy
![Page 8: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/8.jpg)
Shared Vertex
• Pros– Convenient and efficient (memory wise)– Can represent non-manifold meshes
• Cons– Too simple - not enough information on relations between
vertices & faces
![Page 9: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/9.jpg)
Shared Vertex
• What are the vertices of face f1?– O(1) – first triplet from face list
![Page 10: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/10.jpg)
Shared Vertex
• What are the one-ring neighbors of v3?– Requires a full pass over all faces
![Page 11: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/11.jpg)
Shared Vertex
• Are vertices v1 and v5 adjacent?– Requires a full pass over all faces
![Page 12: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/12.jpg)
Complete Adjacency Lists
• Store all vertex, edge, and face adjacencies – Efficient topology traversal– Extra storage
![Page 13: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/13.jpg)
Partial Adjacency Lists
• Can we store only some adjacency relationships and derive others?
![Page 14: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/14.jpg)
Face Based Connectivity• Manifold triangular meshes• Vertex
– Position– 1 adjacent face index
• Face– 3 vertex indices– 3 neighboring face indices
• Pros – most adjacency queries in O(1) time
• Cons– No (explicit) edge information
![Page 15: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/15.jpg)
Edge Based Connectivity(Winged Edge)
• Vertex– Position– 1 adjacent edge index
• Edge– 2 vertex indices– 2 neighboring face indices– 4 edges
• Face– 1 edge index
![Page 16: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/16.jpg)
Edge Based Connectivity(Winged Edge)
• Example
![Page 17: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/17.jpg)
Edge Based Connectivity(Winged Edge)
• Pros– Most adjacencies in O(1) time– Arbitrary polygons
• Cons – No edge orientation information
![Page 18: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/18.jpg)
Half Edge• Vertex record:
– Coordinates– Pointer to one half-edge that has v as its origin
• Face record:– Pointer to one half-edge on its boundary
• Half-edge record:– Pointer to its origin, origin(e)– Pointer to its twin half-edge, twin(e)– Pointer to the face it bounds, IncidentFace(e) (face lies to left of e when
traversed from origin to destination)– Next and previous edge on boundary of IncidentFace(e)
![Page 19: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/19.jpg)
Half Edge
• Operations supported– Walk around boundary of given face– Visit all edges incident to vertex v
• Queries– Most queries are O(1)
![Page 20: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/20.jpg)
Half Edge
• Example
![Page 21: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/21.jpg)
Half Edge
• Example (cont.)
![Page 22: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/22.jpg)
Half Edge
• Pros– Most adjacency queries in O(1) time– Local operations are O(1) (usually)
• Cons– Represents only manifold meshes
![Page 23: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/23.jpg)
Adjacency Matrix
• View mesh as connected graph• Given n vertices build n*n matrix of adjacency
information– Entry (i,j) is TRUE if vertices i and j are adjacent
• Geometric info – list of vertex coordinates• Add faces - list of triplets of vertex
indices(v1,v2,v3)
![Page 24: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/24.jpg)
Adjacency Matrix
• Example
![Page 25: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/25.jpg)
Adjacency Matrix
• Symmetric for undirected simple graphs• (An) ij= # paths of length n from vi to vj
• Pros– Information on vertices adjacency– Stores non-manifold meshes
• Cons– Connects faces to their vertices, BUT NO
connection between vertex and its face• How to find the 1-ring neighboring faces for a vertex?
![Page 26: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/26.jpg)
Corner Table
• Corner c contains– Triangle – c.t– Vertex – c.v– Next corner in c.t (ccw) – c.n– Previous corner – c.p (==c.n.n)– Corner opposite c – c.o
• E edge opposite c – not incident on c.v• c.o couples triangle T adjacent to c.t across E with vertex of T not incident on E
– Right corner – c.r – corner opposite c.n (==c.n.o)– Left corner – c.l (== c.p.o == c.n.n.o)
Corner: Coupling of vertex with one of its incident triangles
![Page 27: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/27.jpg)
Corner Table
• Store– Corner table– For each vertex – a list of all its corners
• Corner number j*3-2, j*3-1 and j*3 match face number j ( j = 1, 2, … )– No need for explicit face storage
![Page 28: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/28.jpg)
Corner Table
• Example
![Page 29: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/29.jpg)
Corner Table
• Pros– Topological queries in O(1) time– Most operations are O(1)– Convenient for rendering (triangle fans)
• Cons– Only triangular, manifold meshes– Redundancy (but not too high)
![Page 30: Mesh Data Structure](https://reader036.fdocuments.in/reader036/viewer/2022062304/568145b8550346895db2c0f5/html5/thumbnails/30.jpg)
Quiz
• For each of the above data structure– What are the vertices of face fi ?
– What is the 1-ring neighbors (vertices/edges/faces) of vertex vi ?
– Are vertices vi and vj adjacent?
• 1-ring neighbor loop traversal as shown on the right, if half edge is used.