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 FindUpperTangentHull 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 AiHull Bj 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 AiHull Bj as the upper tangent
procedure FindLowerTangentHull A Hull B
procedure MergeHullsHull A Hull B
upperT angent FindUpperTangentHull A Hull B lowerT angent FindLowerTangentHull 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
