# | Primal | Dual | |
1 |
Sort the points by x coordinate |
Sort the lines by their slope |
|
2 |
Divide the points into 2 sets, A and B, A containing the left [n/2] points, and B the right [n/2] points. |
Divide the lines into 2 sets, A and B, A containing the lines with the first half of smallest slopes, and B the right [n/2] slopes. |
|
3 |
Compute the CH H(A) and H(B) recursively. |
Compute the upper/lower envelopes of the 2 sets, E(A) and E(B) recursively. | |
4 |
Merge H(A) and H(B). |
Merge E(A) and E(B). |
|
  |
We can compute only the upper CH, that is the set of lines obtained by joining the points on the hull that have all the other points below them, and then apply the same algorithm for the lower one (the only change will be that the set of points will have the others above them). |
We can compute only the lower envelope, that is the set of points obtained by intersecting the lines on the envelope, that have all the other lines above them, and then apply the same algorithm for the upper one (the only change will be that the set of points will have the lines below them). |
|
For one point x, CH is that point. |
For one line D(x), the upper envelope is the half plane above it, and the lower one is the half plane below it. | ||
For the upper CH, the goal is to find a tangent line that contains all the points below (and two of them on it). |
For the lower envelope, the goal is to find the point of intersection so that the point is below all the lines in the envelope (and on two of them). |
||
We let the upper tangent be T=ab, where a and b are the rightmost and leftmost respectively points on A and B. Then we "walk" it upwards till we find the tangent (the line with all the points on or below). Sometimes, we will have to change the fixed point to a point from the other CH (a <- b or b <- a , depending on which one was fixed before). |
We let the point D(T) be the intersection of D(a) and D(b), the lines with the greatest/smallest slope in their envelopes. Then we walk on the lines downwards until we find D(T) the dual of the tangent, i.e. the point that has all the other lines above. Sometimes, we will have to change the fixed line we were walking on to a line from the other envelope (in the order of their slopes). |
||
  | Repeat for the lower CH. | Repeat for the upper envelope. |