CP2 TermProjects List of Projects PDF
CP2 TermProjects List of Projects PDF
(Spring 2016-2017)
Coding Project-2 (CP-2) Duration: Mar 23 Apr 6, 2017
General Note:
I. You can use any programming language like C, C++, Java, Python, etc., in which you are
comfortable. However, GUI (graphical user interface) of visualization of execution the
algorithm and the solution is required.
II. One from this list will be assigned to your group for working on this coding project.
III. Duration of this project is 2 weeks.
==========================================================================
List of Problem Statements for Coding Project-2:
2. Solve the problem of finding movement of a ball over a given surface considering that an arbitrary
(random) polygonal chain is taken as input from the user. No need consider the velocity of the ball.
Show all the intermediate positions of the ball and also the final position (in case ball has fallen from
the polygon chain then indicate that). For an example:
3. Solve the problem of triangulating a polygon using Ear-Removal Algorithm considering the following
instructions:
(a) Construct a simple polygon with n vertices. Your program should be able to take n as input (e.g.,
20) from the user, then randomly generates n distinct points with X and Y coordinates in 2D
geometry. Store the simple polygon using the required data structure DCEL.
(b) Triangulate the polygon using Ear Removal method. Store the information in the required data
structure (another DCEL).
(c) Display the dual graph of the triangulated polygon. Store the information of the dual graph in the
required data structure (another DCEL).
4. Solve the problem of finding the convex hull and triangulating that using the algorithm for triangulating
monotone partitions considering the following instructions:
(a) Your program should take n as input (e.g., 20) from the user, then randomly generates n distinct
points with X and Y coordinates in 2D geometry.
(b) Draw the convex hull of these set of points using Quick Hull method. Store the information in the
required data structure DCEL.
(c) Now assume the convex hull as the given monotone polygon. Triangulate this monotone polygon
using line sweep algorithm. Store the information in the required data structure (another DCEL).
5. Solve the problem of finding the convex layers considering the following instructions:
(a) Your program should take n as input (n can be large) from the user, then randomly generates n
distinct points with x and y coordinates in 2D geometry.
(b) Draw the convex hull of these set of points using Gift Wrapping Algorithm. Store the information
in the required data structure DCEL.
(c) If after constructing convex hull some points (greater than 1) are left out of n points inside the
above convex hull. Draw convex hull again using these remaining points by Quick hull algorithm.
Repeat step 3 process to draw rings of convex hulls until less than 1 points left inside last
constructed convex hull. Store the information in the required data structure (another DCEL).
6. Solve the problem of finding the staircase considering the following instructions:
Let X be a set of points in the plane. A point p in X is Pareto-optimal if no other point in X is both
above and to the right of p. The Pareto-optimal points can be connected by horizontal and vertical lines
into the staircase of X, with a Pareto-optimal point at the top right corner of every step. See the figure
below.
(a) QUICKSTEP: Describe a divide-and-conquer algorithm to compute the staircase of a given set of
n points in the plane in O(n log n) time.
(b) SCANSTEP: Describe an algorithm to compute the staircase of a given set of n points in the plane,
sorted in left to right order, in O(n) time.
(c) NEXTSTEP: Describe an algorithm to compute the staircase of a given set of n points in the plane
in O(nh) time, where h is the number of Pareto-optimal points.
(d) SHATTERSTEP: Describe an algorithm to compute the staircase of a given set of n points in the
plane in O(n log h) time, where h is the number of Pareto-optimal points.
7. Solve the problem of finding the staircase layers considering the following instructions:
The staircase layers of a point set are defined by repeatedly computing the staircase and removing the
Pareto-optimal points from the set, until the set becomes empty.
(a) Describe and analyze an algorithm to compute the staircase layers of a given set of n points in O(n2)
time.
(b) Describe and analyze an algorithm to compute the staircase layers of a given set of n points in O(n
log n) time.
(c) An increasing subsequence of a point set X is a sequence of points in X such that each point is
above and to the right of its predecessor in the sequence. Describe and analyze an algorithm to
compute the longest increasing subsequence of a given set of n points in the plane in O(n log n)
time. [Can you give any solution that uses part (b)]
8. Solve the problem of finding the skylines of a city considering the following instructions:
This problem asks you to compute skylines of various cities. In each city, all the buildings have a
signature geometric shape. Describe an algorithm to compute a description of the union of n such shapes
in O(n log n) time.
(a) Manhattan: Each building is a rectangle whose bottom edge lies on the X-axis, specified by the left
and right X-coordinates and the top Y-coordinate.
(b) Giza: Each building is a right isosceles triangle whose base lies on the x-axis, specified by the (X,
Y)-coordinates of its apex.
(c) Nome: Each building is a semi-circular disk whose centre lies on the X-axis, specified by its centre
X-coordinate and radius.
Given any random inputs, demonstrate your plane-sweep algorithm to find out the respective skyline
for each of these three cities.
C1
C2 C3
Step 5: Using the remaining points of all the convex hulls, draw another convex hull
12. Solve the problem considering the following instructions:
(a) Your program should take n as input (n can be large) from the user, then randomly generates n
distinct points with x and y coordinates in 2D geometry.
(b) Draw the convex hull of these set of points using Quick Hull method. Store the information in the
required data structure DCEL.
(c) If after constructing convex hull some points (greater than 3) are left out of n points inside the
above convex hull. Draw the simple polygon using these remaining points. Store the information
in the required data structure DCEL.
(d) Triangulate the simple polygon using any method studied in the course. Store the information in
the required data structure DCEL.
13. A farmer owns a land has a shape of convex hull. One of its neighbor changes the fencing by shifting
one of the pole. So, your task is find out whether the farmer will able to know the changes in his fencing
or not.
(a) Randomly draw a convex polygon
(b) Now randomly select a pole and change its coordinates
(c) If point is still in the convex hull then John cannot detect the changes made by its neighbor
An overlap graph GO = (V, EO), where V and EO are the vertex and edge sets, respectively.
V = {vi | vi represents interval Ii} and EO = {(vi, vj) | li <lj < ri < rj}.
An interval graph GI = (V, EI), where V and EI are the vertex and edge sets, respectively. The vertex
set V = {vi | vi represents interval Ii} and two vertices are joined by an edge if and only if their
corresponding intervals have a non-empty intersection.
Figure 1 (a) Set of Intervals A, B, C, D, E, F (b) Overlap Graph (GO) (c) Interval Graph (GI).
This can be implemented by moving the sweep line from left to right direction while initializing
the event queue with left and right edges of the rectangles in sorted order. The main idea is to
maintain the set of active rectangles in order (y-coordinates) of the rectangles where active
rectangles are those whose left edge has been found by sweep line while right edge is still not found.
Whenever a right edge is encounter, find the area of all active rectangles and remove this rectangle
from the list.
Help: https://web.stanford.edu/class/cs97si/09-computational-geometry.pdf
20. Solve the problem considering the following instructions:
Given a maximum distance (d) between two rectangles, construct a conflict graph (CG) from N axis-
aligned randomly generated rectangles (R1, R2, , RN). A conflict graph is a graph (V, E) where V =
{vi | vi represents rectangle Ri} and E = {(vi, vj) | distance (vi, vj) < d}. The conflict graph should be
constructed using Projection method.
Figure 2 (a) Axis-aligned rectangles, (b) Projection from A, (c) Intermediate conflict graph by
considering the rectangle A from (b), (d) Final Conflict graph.
Projection Method: For a given rectangle Ri, the projection method finds all the neighbor rectangles
with the distance less than d by assuming a virtual vertical and horizontal projection from all the four
corners of Ri.
(i) If the projections intersect with other rectangles edges (as shown in figure 2(b)) then find the
distance among them and compare with the given maximum distance (d). If calculated distance is
< d then draw an edge between their corresponding vertices in conflict graph.
(ii)If k rectangles has intersection with the projection of rectangle A as shown in figure 2(b) then for
remaining (n-k-1) rectangles, draw the projections from their endpoints. If the projections intersect
with the selected rectangles (in given example, the selected rectangle is A) projection then
calculate the Euclidean distance between them and compare to d. If distance is within the threshold
(d) and there is no obstacle encountered then draw an edge between their corresponding vertices
in conflict graph.
Note: Use plane sweep to find obstacles.
Implementation steps:
Find monotone decomposition diagonals using a plane sweep.
Use diagonals to break the input list into vertex lists for the monotone pieces.
Sort the vertex list for each monotone piece by y-coordinate and triangulate.
22. Solve the problem considering the following instructions:
Convex Hull
(a) Randomly generate n number of points.
(b) Implement the convex hull using Divide and Conquer method for these n random points and store
the information using data structure DCEL.
(c) Also, implement the convex hull of the same set of points using Incremental method and store the
information using DCEL.