mesh data structure. meshes boundary edge: adjacent to 1 face regular edge: adjacent to 2 faces...

30
Mesh Data Structure

Upload: bethanie-randall

Post on 01-Jan-2016

222 views

Category:

Documents


1 download

TRANSCRIPT

Mesh Data Structure

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

• 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

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

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

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

Independent Faces

• Pros– Simple– STL file

• Cons– No connectivity not for topological queries– Redundancy

Shared Vertex

• Pros– Convenient and efficient (memory wise)– Can represent non-manifold meshes

• Cons– Too simple - not enough information on relations between

vertices & faces

Shared Vertex

• What are the vertices of face f1?– O(1) – first triplet from face list

Shared Vertex

• What are the one-ring neighbors of v3?– Requires a full pass over all faces

Shared Vertex

• Are vertices v1 and v5 adjacent?– Requires a full pass over all faces

Complete Adjacency Lists

• Store all vertex, edge, and face adjacencies – Efficient topology traversal– Extra storage

Partial Adjacency Lists

• Can we store only some adjacency relationships and derive others?

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

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

Edge Based Connectivity(Winged Edge)

• Example

Edge Based Connectivity(Winged Edge)

• Pros– Most adjacencies in O(1) time– Arbitrary polygons

• Cons – No edge orientation information

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)

Half Edge

• Operations supported– Walk around boundary of given face– Visit all edges incident to vertex v

• Queries– Most queries are O(1)

Half Edge

• Example

Half Edge

• Example (cont.)

Half Edge

• Pros– Most adjacency queries in O(1) time– Local operations are O(1) (usually)

• Cons– Represents only manifold meshes

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)

Adjacency Matrix

• Example

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?

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

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

Corner Table

• Example

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)

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.