Question: Given the following code to merge convex hulls including the code for the upper tangent, write the code finding the lower tangent. Input: Two convex

Given the following code to merge convex hulls including the code for the upper tangent, write the code finding the lower tangent.
Input: Two convex hulls, Hull A and Hull B Output: Merged convex hull
procedure FindUpperTangent(Hull A, Hull B)
Set i = index of the rightmost point of Hull A
Set j = index of the leftmost point of Hull B
while line segment (Hull A[i],Hull B[j]) is not an upper tangent do
if not an upper tangent for Hull A then Move i counterclockwise in Hull A
else if not an upper tangent for Hull B then Move j clockwise in Hull B
return (Hull A[i],Hull B[j]) as the upper tangent
procedure FindLowerTangent(Hull A, Hull B)
procedure MergeHulls(Hull A, Hull B)
upperT angent FindUpperTangent(Hull A, Hull B) lowerT angent FindLowerTangent(Hull A, Hull B) Initialize an empty list for the merged hull
Traverse points from upperTangent to lowerTangent on Hull A Traverse points from upperTangent to lowerTangent on Hull B return the merged convex hull

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!