Title: Topological Hierarchy Sorting Algorithm
1Topological Hierarchy Sorting Algorithm
Supervised by Dr. Michiel Smid
2Content
- Background problem
- Overall view of the topological hierarchy sorting
algorithm - Techniques
- Data Structures
- Implementation and quick demo
3Background
- Layered Manufacturing builds a freeform object
layer by layer - The author of the paper A topological hierarchy
- sorting algorithm for layered manufacturing
(written by S.H. Choi and K.T. Kwok) developed a
hierarchy-sorting algorithm to simplify a
particular problem - Dr. Smid found a way to improve the algorithm
- The algorithm can be applied for the following
- Virtual simulation of LM
- Medical imaging
- Building objects made out of multiple materials
4Problem
- Building a hierarchy tree such that the tree
follows the following property
The node u is the parent of the node v if the
polygon at v is nested immediately within the
polygon stored at u.
v
u
5Example
c1
c4
c1
c2
c6
c3
c5
6Example
c1
c4
c1
c2
c6
c2
c3
c4
c3
c5
7Example
c1
c4
c1
c2
c6
c2
c3
c4
c5
c3
c5
8Example
c1
c4
c1
c2
c6
c2
c3
c4
c5
c6
c3
c5
9The Algorithm
- Concept
- Each polygon is represented by a simple structure
- Sweep line technique
- A modified version of the Skip List to store
edges that are crossing the sweep line - When the new polygon P is discovered by the sweep
line, we find the parent polygon for P
10The Algorithm (Continued)
- Click here to run the demo.
11Example of a Fake Parent
- When the sweep line discovers a new polygon, it
will search for the closest top and bottom edges.
Since these two edges are from the same polygon,
the new polygon will have the parent P. However,
this is not true. To fix this problem we
introduce a technique called Internal and
External Edges.
12Internal and External Edges
- Take an edge and look at its top. If the top of
the edge is touching the outside area of the
polygon, then this is an exterior edge. Otherwise
the edge is an interior one. - To determine whether the edge is interior or
exterior Starting from the left most point, move
the polygon counter clockwise. If point .x lt
.x ,then this is an interior edge.
Otherwise this is an exterior edge.
13Back to the Example of the Fake Parent
- We again search for a top and bottom edge. The
top edge must be external whereas the bottom edge
must be internal. The example shows the opposite
case the parent of the new polygon is the parent
of polygon P.
14All Possible Cases
15Keeping Track of Edges that are Intersecting the
Sweep Line Skip List
- Another way to look at it How to jump in a
linked list. - Insert, remove, and search method run in O(logn)
expected time
16Modified Version of the Skip List
- Key Element for all the nodes in the skip list.
- The key is the end points of an edge
- The left most column nodes key are replaced with
the topmost edge of the root polygon in a
specific layer - The right most column nodes key are replaced with
the bottommost edge of the root polygon in a
specific layer - The search method is performed by test turns
- Two new search methods are added
searchForTopEdge and searchForBottomEdge - The delete method receives the point p and
deletes any edge that contains point p
17Example of Modified Version of the Skip List
18And if We Rotate the Skip List...
19How to Move the Sweep Line
- We extract all the vertices of a polygon and
assign each vertex an action Insertion, Removal
and Update Point. Each vertex has a pointer to
the edge that is incident. Each edge has a
pointer to the polygon. - We do this for all polygons, and place all the
points in the array. Then we sort the array. The
leftmost point of the array is the first point
that the sweep line will touch.
20Dealing with Vertical Edges
- Vertical edges are a pain. We just ignore them
(do not add them to the skip list). However, we
must be careful with each vertex action.
21Compilation
- For each layer, the algorithm goes through two
stages - Preprocess
- Convert each contour to a polygon
- Extract all the vertices, add to an array A, and
sort the array. This array will make the sweep
line move. - Create a root polygon to contain all the polygons
- Building the Hierarchy Tree
- Initialize the skip list
- Process each vertex of the array
- If the vertex v is the leftmost point of a new
polygon, assign the parent to the new polygon by
going through all the cases in slide x. - If the vertex v is an update point, find the edge
in the skip list that is incident to v, and
replace it with the new edge. - If the vertex v is a removal point, find all the
edges in the skip list that are incident to v,
and remove all of them. - Running time O(nlogn) time.
22Implementation and Demo
- Implemented the algorithm in java using Eclipse
IDE - Tested the algorithm with a sample dataset of a
human pelvis - Click here for the demo
23Questions
24(No Transcript)