Presentation is loading. Please wait.

Presentation is loading. Please wait.

University of British Columbia Compressing Connectivity.

Similar presentations


Presentation on theme: "University of British Columbia Compressing Connectivity."— Presentation transcript:

1 University of British Columbia Compressing Connectivity

2 University of British Columbia Compressing Connectivity Encode mesh structure adjacency + orientation User can control traversal order => order (+ info stored) define encoding Compression = Utilize redundancy In mesh Face has 3 vertices Most edges have 2 faces => Edgebreaker Most vertices have valence 6 => TG coder

3 University of British Columbia TG Connectivity Coder: Intuition Vertex based traversal Edges incident on any vertex can be ordered consistently counter-clockwise True in any planar graph Determines order demo

4 University of British Columbia TG Connectivity Coder Grow encoded (decoded) region Use spiral-like border extension add Output “add 4” Pivot Cut Border New Vertex Free edges 1 3 1 1 2 1 2 1 1 3 2 1 0 1 2

5 University of British Columbia TG Connectivity Coder Remove full vertex 1 2 3 2 2 3 2 0 1 2 3 2 2 2 1

6 University of British Columbia TG Coder – Special Cases Add dummy vertices BeforeAfter Close mesh Boundaries

7 - get Mesh; // Input mesh - declare Stack; // Stack of active lists - declare ActiveList; // Current active list - declare VertexList; // Boundary loop vertexes Stack Output Mesh - while Mesh.HasBoundary() - VertexList := Mesh.GetBoundaryLoop(); // Catch all boundary loops - Vertex u(dummy, VertexList.size); // Create dummy vertex - Mesh.Add(u, VertexList); // Connect them together Stack Output Mesh - while Mesh.HasBoundary() - VertexList := Mesh.GetBoundaryLoop(); // Catch all boundary loops - Vertex u(dummy, VertexList.size); // Create dummy vertex - Mesh.Add(u, VertexList); // Connect them together - pick an unvisited triangle (v1,v2,v3) of Mesh; - ActiveList.Add(v1,v2,v3); - output(“add %d add %d add %d”, v1.degree, v2.degree, v3.degree); - ActiveList.focus := v1; Stack.push(ActiveList); Stack 1-2-3 Output Add 7, Add 6, Add 7 1 3 2 Mesh - while Mesh.HasBoundary() - VertexList := Mesh.GetBoundaryLoop(); // Catch all boundary loops - Vertex u(dummy, VertexList.size); // Create dummy vertex - Mesh.Add(u, VertexList); // Connect them together Stack 1-2-3-4 Output Add 5 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible 1 3 2 4 Stack 1-2-3-4-5 Output Add 4 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible Mesh 1 3 2 4 5 Stack 1-2-3-4-5-6 Output Add dummy 10 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible 1 3 2 4 5 6 Mesh Stack 1-2-3-4-5-6-7 Output Add 3 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible 1 3 2 4 5 6 7 Mesh Stack 1-2-3-4-5-6-7-8 Output Add 4 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible 1 3 2 4 5 6 7 8 Mesh Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices // focus just marked for removal 1 3 2 4 5 6 7 8 Stack 1-2-3-4-5-6-7-8 Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices Mesh 1 3 2 4 5 6 7 8 Stack 1-2-3-4-5-6-7-8 Mesh Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices Stack 1-2-3-4-5-6-7-8 1 3 2 4 5 6 7 8 Mesh Stack 2-3-4-5-6 Output - if ActiveList.focus.Full() // if current focus full - ActiveList.focus = ActiveList.focus.NextNeighbor() // move focus 1 3 2 4 5 6 7 8 Mesh Stack 2-3-4-5-6-9 Output Add 4 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible 1 3 2 4 5 6 7 8 9 Mesh Stack 2-3-4-5-6-9-10 Output Add 4 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible 1 3 2 4 5 6 7 8 910 Mesh Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices // focus just marked for removal 1 3 2 4 5 6 7 8 910 Stack 2-3-4-5-6-9-10 Mesh Stack 3-4-5-6-9-10 Output - if ActiveList.focus.Full() // if current focus full - ActiveList.focus = ActiveList.focus.NextNeighbor() // move focus 1 3 2 4 5 6 7 8 910 Mesh Stack 3-4-5-6-9-10-11 Output Add 4 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible 1 3 2 4 5 6 7 8 910 11 Mesh Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices 1 3 2 4 5 6 7 8 910 11 Stack 3-4-5-6-9-10-11 Mesh Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices 1 3 2 4 5 6 7 8 910 11 Stack 3-4-5-6-9-10-11 Mesh Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices 1 3 2 4 5 6 7 8 910 11 Stack 3-4-5-6-9-10-11 Mesh Stack 3-4-5-6-12 Output Add 4 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible 1 3 2 4 5 6 7 8 910 11 12 Mesh Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices // focus just marked for removal Stack 3-4-5-6-12 1 3 2 4 5 6 7 8 910 11 12 Mesh Output - if ActiveList.focus.Full() // if current focus full - ActiveList.focus = ActiveList.focus.NextNeighbor() // move focus Stack 4-5-6-12 1 3 2 4 5 6 7 8 910 11 12 Mesh Output Add 4 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible Stack 4-5-6-12-13 1 3 2 4 5 6 7 8 910 11 12 13 Mesh Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices // focus just marked for removal 1 3 2 4 5 6 7 8 910 11 12 13 Stack 4-5-6-12-13 Mesh Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices 1 3 2 4 5 6 7 8 910 11 12 13 Stack 4-5-6-12-13 Mesh Output - ActiveList.RemoveFullVertices(); // remove exhausted vertices // the last triangle removed // all triangles of Mesh are visited Stack 6-12-13 1 3 2 4 5 6 7 8 910 11 12 13 TG Encoding Example

8 University of British Columbia TG Encoding Algorithm: Output Output command sequence: Add 7, Add 6, Add 7, Add 5, Add 4 Add dummy 10 Add 3, Add 4, Add 4, Add 4, Add 4, Add 4, Add 4 Entropy compressed bitstream: Huffman code: Add 4 Add 7 Add 5 Add 6 Add dummy 10 Add 3 1 00 0100 0101 0110 0111 Resulting in 27 bits = 2.25 bits/vertex

9 - get input; // Input encoded mesh - declare Stack; // Stack of active lists - declare ActiveList; // Current active list Stack Input Mesh - pick an unvisited triangle (v1,v2,v3) of Mesh; - ActiveList.Add(v1,v2,v3); - output(“add %d add %d add %d”, v1.degree, v2.degree, v3.degree); - ActiveList.focus := v1; Stack.push(ActiveList); Stack 1-2-3 Input Add 7, Add 6, Add 7 - while not EOF - read degrees of vertices (v1,v2,v3); - Mesh.Add(v1, v2, v3); // catch first triangle - ActiveList.Add(v1,v2,v3); ActiveList.focus := v1; Stack.Push(ActiveList); Mesh 1 3 2 Stack 1-2-3-4 Input Add 5 - e:=ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - Vertex u(degree); // create new vertex u, with the given degree - ActiveList.Add(u); // insert u between focus and its predecessor - Mesh.Add(u); // update the mesh to have two more edges Mesh 1 3 2 4 Stack 1-2-3-4-5 Input Add 4 - e:=ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - Vertex u(degree); // create new vertex u, with the given degree - ActiveList.Add(u); // insert u between focus and its predecessor - Mesh.Add(u); // update the mesh to have two more edges Mesh 1 3 2 4 5 Stack 1-2-3-4-5-6 Input Add dummy 10 - e:=ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - DummyVertex u(degree); // create new vertex u, with the given degree - ActiveList.Add(u); // insert u between focus and its predecessor - Mesh.Add(u); // update the mesh to have two more edges Mesh 5 6 1 3 2 4 5 Stack 1-2-3-4-5-6-7 Input Add 3 - e:=ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - DummyVertex u(degree); // create new vertex u, with the given degree - ActiveList.Add(u); // insert u between focus and its predecessor - Mesh.Add(u); // update the mesh to have two more edges Mesh 7 5 6 1 3 2 4 5 Stack 1-2-3-4-5-6-7-8 Input Add 4 - e:=ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - DummyVertex u(degree); // create new vertex u, with the given degree - ActiveList.Add(u); // insert u between focus and its predecessor - Mesh.Add(u); // update the mesh to have two more edges Mesh 7 5 6 1 3 2 4 5 7 8 Input - ActiveList.RemoveFullVertices(); // remove exhausted vertices // focus just marked for removal Mesh 7 5 6 1 3 2 4 5 7 8 Stack 1-2-3-4-5-6-7-8 Input - ActiveList.RemoveFullVertices(); // remove exhausted vertices Mesh 7 5 6 1 3 2 4 5 7 8 Stack 1-2-3-4-5-6-7-8 Input - ActiveList.RemoveFullVertices(); // remove exhausted vertices Stack 1-2-3-4-5-6-7-8 Mesh 7 5 6 1 3 2 4 5 7 8 Stack 2-3-4-5-6 Output - if ActiveList.focus.Full() // if current focus full - ActiveList.focus = ActiveList.focus.NextNeighbor() // move focus Mesh 7 5 6 1 3 2 4 5 7 8 Stack 2-3-4-5-6-9 Input Add 4 - e:=ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - DummyVertex u(degree); // create new vertex u, with the given degree - ActiveList.Add(u); // insert u between focus and its predecessor - Mesh.Add(u); // update the mesh to have two more edges Mesh 7 5 6 1 3 2 4 5 7 8 9 Stack 2-3-4-5-6-9-10 Input Add 4 - e:=ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - DummyVertex u(degree); // create new vertex u, with the given degree - ActiveList.Add(u); // insert u between focus and its predecessor - Mesh.Add(u); // update the mesh to have two more edges Mesh 7 5 6 1 3 2 4 5 7 8 910 Mesh 7 5 6 1 3 2 4 5 7 8 910 Input - ActiveList.RemoveFullVertices(); // remove exhausted vertices // focus just marked for removal Stack 2-3-4-5-6-9-10 Stack 3-4-5-6-9-10 Input - if ActiveList.focus.Full() // if current focus full - ActiveList.focus = ActiveList.focus.NextNeighbor() // move focus Mesh 7 5 6 1 3 2 4 5 7 8 910 Stack 3-4-5-6-9-10-11 Input Add 4 - e:=ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - DummyVertex u(degree); // create new vertex u, with the given degree - ActiveList.Add(u); // insert u between focus and its predecessor - Mesh.Add(u); // update the mesh to have two more edges Mesh 7 5 6 1 3 2 4 5 7 8 910 11 Input - ActiveList.RemoveFullVertices(); // remove exhausted vertices Stack 3-4-5-6-9-10-11 Mesh 7 5 6 1 3 2 4 5 7 8 910 11 Input - ActiveList.RemoveFullVertices(); // remove exhausted vertices Mesh 7 5 6 1 3 2 4 5 7 8 910 11 Stack 3-4-5-6-9-10-11 Input - ActiveList.RemoveFullVertices(); // remove exhausted vertices Stack 3-4-5-6-9-10-11 Mesh 7 5 6 1 3 2 4 5 7 8 910 11 Stack 3-4-5-6-12 Input Add 4 - e:=ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - DummyVertex u(degree); // create new vertex u, with the given degree - ActiveList.Add(u); // insert u between focus and its predecessor - Mesh.Add(u); // update the mesh to have two more edges Mesh 7 5 6 1 3 2 4 5 7 8 910 11 12 Input - ActiveList.RemoveFullVertices(); // remove exhausted vertices // focus just marked for removal Stack 3-4-5-6-12 Mesh 7 5 6 1 3 2 4 5 7 8 910 11 12 Input - if ActiveList.focus.Full() // if current focus full - ActiveList.focus = ActiveList.focus.NextNeighbor() // move focus Stack 4-5-6-12 Mesh 7 5 6 1 3 2 4 5 7 8 910 11 12 Input Add 4 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible Stack 4-5-6-12-13 Mesh 7 5 6 1 3 2 4 5 7 8 910 11 12 13 Input - ActiveList.RemoveFullVertices(); // remove exhausted vertices // focus just marked for removal Stack 4-5-6-12-13 Mesh 7 5 6 1 3 2 4 5 7 8 910 11 12 13 Input - ActiveList.RemoveFullVertices(); // remove exhausted vertices Stack 4-5-6-12-13 Mesh 7 5 6 1 3 2 4 5 7 8 910 11 12 13 Input EOF - ActiveList.RemoveFullVertices(); // remove exhausted vertices // the last triangle removed // all triangles of Mesh are visited Mesh 1 3 2 4 5 6 7 8 910 11 12 13 Stack 6-12-13 Input - while Mesh.HasDummy() // handle boundaries - Vertex dummy:= Mesh.GetDummy(); // pick a dummy vertex - Mesh.Remove(dummy); // remove dummy and all its incident edges Mesh 1 3 2 4 5 7 8 910 11 12 13 Stack TG Decoding Example

10 University of British Columbia TG Coder – Special Cases Cut-border intersects itself: split Offset = distance (sum of free counts from focus to split vertex ) Output “split 6” Second Cut Border 1 2 3 1 1 2 2 1 2 1 3 2 1 2 3 1 1 2 2 0 1 1 1 1 2 1

11 University of British Columbia More TG Special Cases Genus > 0: Merge operation required Occurs when two different cut-borders intersect Non-manifolds: Cut into manifold pieces

12 University of British Columbia Another TG Example Code: Add 6 Add 7 Add 4 Add 4 Add 8 Add 5 Add 5 Add 4 Add 5 Split 5 Add 4 Add 4 Add Dummy 6 Add 4

13 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if u.Free() - ActiveList.Add(u); output(“add %d”, u.degree); // This is always possible Stack Mesh Output Add 5 9 2 2-3-4-5-6-7- 8-9 5 67 34 1 8 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - u := ActiveList.focus.Neighbor(e); // neighboring vertex along edge e - if ActiveList.IsIn(u) - (ActiveList, ActiveList1) := ActiveList.Split(e); Stack.Push(ActiveList1); - output(“split %d”, offset from ActiveList.focus to u); Mesh Output Split 5 Stack 2-5-6-7-8-9 9 25 67 34 1 8 2-3-4-5 - if ActiveList.focus.Full() // if current focus full - ActiveList.focus = ActiveList.focus.NextNeighbor() // move focus Mesh Output Stack 9 25 67 34 1 8 5-6-7-8-9 2-3-4-5 TG Split Encoding Example

14 - e:=ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - Vertex u(degree); // create new vertex u, with the given degree - ActiveList.Add(u); // insert u between focus and its predecessor - Mesh.Add(u); // update the mesh to have two more edges Stack Mesh Input Add 5 9 25 67 34 1 8 2-3-4-5-6-7- 8-9 - e := ActiveList.focus.FreeEdge(); // next free edge in c. clockwise order - (ActiveList, ActiveList1) := ActiveList.Split(e); - Stack.Push(ActiveList1); Stack Mesh Input Split 5 9 25 67 34 1 8 2-5-6-7-8-9 2-3-4-5 - if ActiveList.focus.Full() // if current focus full - ActiveList.focus = ActiveList.focus.NextNeighbor() // move focus Stack Mesh Input 9 25 67 34 1 8 5-6-7-8-9 2-3-4-5 Implementation details TG Split Decoding Example

15 University of British Columbia Typical Command Distribution Coded to 2.0 bits/vertex

16 University of British Columbia TG Implementation Details May be implemented using stack or recursively Each cut-border vertex has free-edge counter Initialialized to valence-2 when vertex generated Slide Slide Decremented by one at each add operation when it is focus SlideSlide Can cause snowball effect on neighboring vertices when hits zero (zip !) SlideSlide Updated by the appropriate number when affected by split SlideSlide

17 University of British Columbia AD Improvement When removing a full vertex instead of advancing pivot one vertex along cut-border : Use heuristic which depends only on current state of the cut-border Best-performing heuristic chooses vertex with least number of free edges Maintains “tight” cut-border Number of “split” commands drops significantly (in practice)

18 University of British Columbia TG Algorithm Performance Disadvantages: No theoretical upper bound on code length Advantages: Gives very good compression rates (approx 2 bits/vertex) on typical meshes Gives excellent rates on highly regular meshes

19 University of British Columbia Lower Bound on Connectivity Coding Performance Theorem (Tutte, 1960): Asymptotically (as n  ) number of different planar triangulations on n vertices tends to Entropy of this (uniform) distribution per vertex is bits/vertex

20 University of British Columbia Encoding Triangulated Polygon No internal vertices Dual graph is binary tree Can be easily encoded with 2 bits per triangle Each bit indicates presence of one of the two children 10110011 01001000 00 – no children 10 – has left child only 01 – has right child only 11 – has both children Does not work for general triangulation !!

21 University of British Columbia Edgebreaker Connectivity Coding Move from triangle (Y) to adjacent one (X) via active gate Mark all visited triangles and their vertices According to case: Assign symbol to current triangle Decide where to continue v LeftRight X Y

22 Case C (new vertex) : Edgebreaker Encoding

23 Case R (triangle to the right) : Edgebreaker Encoding

24 Case L (triangle to the left) : Edgebreaker Encoding

25 Case S (split cut-border) : Edgebreaker Encoding

26 Case E (end triangle) : Edgebreaker Encoding

27 C R R R L S L E C RR E CRRRLSLECRRE Edgebreaker Encoding Example

28 University of British Columbia Guaranteed 2t bit code Basic fact: There is one-to-one correspondence between vertices and C operations Conclusion: There are ~ t/2 C symbols If we use 1 bit for C and 3 bits for L, R, S and E, the connectivity cost is: 1* t/2 + 3 * t/2 = 2t bits Example: C – 0 L – 110 E – 111 R – 101 S – 100 CRRRLSLECRRE 0 101 101 101 110 100 110 111 0 101 101 111 (32 bits) demo

29 University of British Columbia Edgebreaker Decoder Principles Decoded triangles inside cut-border Undecoded triangles outside cut-border Decoder grows the inside until there is no undecoded triangle left Every operation moves one triangle from outside to inside Each operation creates new triangle adjacent to active gate E operation creates new cut-border Old cut-border with its active gate is saved on the stack S operation merges active cut-border with cut-border on top of stack C operation closes fan of triangles

30 CLERS string : C R R R L S L E C R R E E E R R R RC C E E Stack L L L S S L L R R R R R RC C Edgebreaker Decoding Example

31 Decoding C  Two cut-border edges are removed and one added  Inserted cut-border edge becomes new gate

32 L : R : Decoding R and L  One cut-border edge is removed and two added  One of the 2 inserted cut-border edges becomes new gate

33 Stack Decoding E  New active cut-border with 3 edges is created  One of the inserted cut-border edges becomes new gate  Current active cut-border is pushed on stack

34 Stack Decoding S  Active cut-border is merged with one popped from stack forming triangle in between  Start vertex of active gate is identified with end vertex of popped gate  Inserted cut-border edge becomes new gate

35 University of British Columbia TG vs. Edgebreaker TGEdgebreaker One symbol per vertexOne symbol per triangle Prefers closed meshPrefers mesh with boundary Decodes in coded orderDecodes in reverse order Split with parameterSplit without parameter Typically short codeCode length bounded Easy to implement


Download ppt "University of British Columbia Compressing Connectivity."

Similar presentations


Ads by Google