Professional Documents
Culture Documents
Convex Hull: Jarvis's Algorithm
Convex Hull: Jarvis's Algorithm
WITH
Jarvis’s Algorithm
SUBMITED TO SUBMIT BY
DEEPAK SIR Ayush Jain
Somya
What is a Convex Polygon?
Polygon where all interior angles are less than 180 degree
Given any 2 points in the polygon, the Line segment between them
GPS System
Image Processing
e.g- How Convex Hull Use is GPS SYSTEM
we like to identify in which restaurant a user in eating,even if the r
rvis(S)
/ S is the set of points
pointOnHull = leftmost point in S // which is guaranteed to be part of the CH(
=0
epeat
P[i] = pointOnHull
endpoint = S[0] // initial endpoint for a candidate edge on the hull
for j from 1 to |S|
if (endpoint == pointOnHull) or (S[j] is on left of line from P[i] to endpoint)
endpoint = S[j] // found greater left turn, update endpoint
i = i+1
pointOnHull = endpoint
until endpoint == P[0] // wrapped around to first hull point
Jarvis March -Example
p10
p9 p6
p7 p5
p12 p p3
p11 p8 p2
4 p1
p0
Jarvis March -Example
p10
p9 p6
p7 p5
p12 p p3
p11 p8 p2
4 p1
p0
Convex Hull={Po}
Jarvis March -Example
p10
p9 p6
p7 p5
p12 p p3
p11 p8 p2
4 p1
p0
Convex Hull={Po,p1}
Jarvis March -Example
p10
p9 p6
p7 p5
p12 p p3
p11 p8 p2
4 p1
p0
Convex Hull={Po,p1,p3}
Jarvis March -Example
p10
p9 p6
p7 p5
p12 p p3
p11 p8 p2
4 p1
p0
Convex Hull={Po,p1,p3,p10}
Jarvis March -Example
p10
p9 p6
p7 p5
p12 p p3
p11 p8 p2
4 p1
p0
Convex Hull={Po,p1,p3,p10,p12}
Running time
Mixture 1 and 2 is to determine whether point (20,30) lies on the line segment formed above
n Line y = -x + c , we get