Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme...

153
Convex Hulls in 2d and 3d

Transcript of Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme...

Page 1: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Convex Hulls in 2d and 3d

Page 2: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Convex Hulls in 2d and 3d

Page 3: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest
Page 4: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Extreme point

Page 5: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Extreme point

Support line

Page 6: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Page 7: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

The lowest point is extreme

Page 8: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Page 9: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Page 10: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Page 11: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Page 12: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Next point is found

Page 13: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Next point is found

Then the next

Page 14: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Next point is found

Then the next

Etc...

Page 15: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Input : S set of points.u = the lowest point of S;min =∞For all w ∈ S \ {u}

if angle(ux, uw) < min then min = angle(ux, uw); v = w;u.next = v;Do

S = S \ {v}For all w ∈ S

min =∞If angle(v.previous v, vw) < min then

min = angle(v.previous v, vw); v.next = w;v = v.next;

While v 6= u

Page 16: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Complexity ?

Input : S set of points.u = the lowest point of S;min =∞For all w ∈ S \ {u}

if angle(ux, uw) < min then min = angle(ux, uw); v = w;u.next = v;Do

S = S \ {v}For all w ∈ S

min =∞If angle(v.previous v, vw) < min then

min = angle(v.previous v, vw); v.next = w;v = v.next;

While v 6= u

Page 17: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Complexity ?

O(n)

Input : S set of points.u = the lowest point of S;min =∞For all w ∈ S \ {u}

if angle(ux, uw) < min then min = angle(ux, uw); v = w;u.next = v;Do

S = S \ {v}For all w ∈ S

min =∞If angle(v.previous v, vw) < min then

min = angle(v.previous v, vw); v.next = w;v = v.next;

While v 6= u

Page 18: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

O(n)

Jarvis march (Gift wrapping)

Complexity ?

Input : S set of points.u = the lowest point of S;min =∞For all w ∈ S \ {u}

if angle(ux, uw) < min then min = angle(ux, uw); v = w;u.next = v;Do

S = S \ {v}For all w ∈ S

min =∞If angle(v.previous v, vw) < min then

min = angle(v.previous v, vw); v.next = w;v = v.next;

While v 6= u

Page 19: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Complexity ?

Input : S set of points.u = the lowest point of S;min =∞For all w ∈ S \ {u}

if angle(ux, uw) < min then min = angle(ux, uw); v = w;u.next = v;Do

S = S \ {v}For all w ∈ S

min =∞If angle(v.previous v, vw) < min then

min = angle(v.previous v, vw); v.next = w;v = v.next;

While v 6= u

Page 20: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Complexity ?

Input : S set of points.u = the lowest point of S;min =∞For all w ∈ S \ {u}

if angle(ux, uw) < min then min = angle(ux, uw); v = w;u.next = v;Do

S = S \ {v}For all w ∈ S

min =∞If angle(v.previous v, vw) < min then

min = angle(v.previous v, vw); v.next = w;v = v.next;

While v 6= u O(n)

Page 21: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Complexity ?

Input : S set of points.u = the lowest point of S;min =∞For all w ∈ S \ {u}

if angle(ux, uw) < min then min = angle(ux, uw); v = w;u.next = v;Do

S = S \ {v}For all w ∈ S

min =∞If angle(v.previous v, vw) < min then

min = angle(v.previous v, vw); v.next = w;v = v.next;

While v 6= u

O(n2)

Page 22: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Jarvis march (Gift wrapping)

Complexity ?

Input : S set of points.u = the lowest point of S;min =∞For all w ∈ S \ {u}

if angle(ux, uw) < min then min = angle(ux, uw); v = w;u.next = v;Do

S = S \ {v}For all w ∈ S

min =∞If angle(v.previous v, vw) < min then

min = angle(v.previous v, vw); v.next = w;v = v.next;

While v 6= u

O(nh)

Page 23: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

Page 24: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Page 25: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Page 26: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Page 27: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Page 28: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Page 29: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Page 30: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 31: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 32: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 33: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 34: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 35: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 36: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 37: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 38: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 39: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 40: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 41: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 42: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 43: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 44: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 45: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham scan

One interior point

Sorting around this point

Scan starting from the lowest point

Page 46: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham Scan

Page 47: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

Page 48: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

Page 49: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

O(n log n)

Page 50: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

O(n log n)O(1)

Page 51: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

O(n log n)O(1)

O(n)

Page 52: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

O(n log n)O(1)

O(n)

Page 53: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

O(n log n)O(1)

O(n)

Page 54: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

O(n log n)O(1)

O(n)

at most n deletions

Page 55: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

O(n log n)O(1)

O(n)

at most n deletions

Page 56: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

O(n log n)O(1)

O(n)

at most n deletions

at most n times

Page 57: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

O(n log n)O(1)

O(n)

O(n)

Page 58: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S a set of n points.origin = barycenter of 3 points of S;sort S around the origin;u = the lowest point of S;v = u;while v.next 6= u

if (v, v.next, v.next.next) turn leftv = v.next;

elsev.next = v.next.next;if v 6= u v = v.previous;

Graham ScanComplexity

O(n log n)

Page 59: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham alternative: origin at y = −∞

Page 60: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham alternative: origin at y = −∞

Sort in x

Page 61: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham alternative: origin at y = −∞

Sort in x

Page 62: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham alternative: origin at y = −∞

Sort in x

Upper envelope

Page 63: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Graham alternative: origin at y = −∞

Upper envelope

Add the lower envelope

Page 64: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Deterministic incremental algorithm

Page 65: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Deterministic incremental algorithm

Page 66: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Deterministic incremental algorithm

Page 67: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Deterministic incremental algorithm

Page 68: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Deterministic incremental algorithm

Page 69: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Deterministic incremental algorithm

Page 70: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Deterministic incremental algorithm

Page 71: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Deterministic incremental algorithm

Page 72: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

Deterministic incremental algorithm

Page 73: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

vu

Deterministic incremental algorithm

Page 74: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

vu

Deterministic incremental algorithmu

Page 75: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

vu

Deterministic incremental algorithmu

u

Page 76: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

vu

Deterministic incremental algorithm

w

Page 77: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

vu

Deterministic incremental algorithm

ww

Page 78: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

Deterministic incremental algorithm

ww

u

Page 79: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

Deterministic incremental algorithmComplexity

Page 80: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

Deterministic incremental algorithmComplexity

O(n log n)

Page 81: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

Deterministic incremental algorithm

Page 82: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

Deterministic incremental algorithmComplexity

Draw an edge in the triangulation

Page 83: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

Deterministic incremental algorithmComplexity

Draw an edge in the triangulation

nb of edges ' 3n

Page 84: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Input : S set of n points.sort S in x;initialize a circular list with the 3 leftmost points

such that u is on the right u, u.next, u.next.next turn left;For v the next point in x

w=uwhile (v, u, u.next) turn right

u = u.next;v.next = u; u.previous = v;while (v, w, w.previous) turn left

w = w.previous;v.previous = w; w.next = v;u = v;

Deterministic incremental algorithmComplexity

O(n log n)

Page 85: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Divide & conquer algorithm

Page 86: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Divide & conquer algorithm

Page 87: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Divide & conquer algorithm

Page 88: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Divide & conquer algorithm

Common tangents

Page 89: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Upper tangent

Page 90: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Upper tangent

Topmost points

Page 91: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Upper tangent

Page 92: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Upper tangent

Page 93: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Upper tangent

O(n)

Page 94: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Divide & conquer algorithm

Complexity

f (n) =

Page 95: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Divide & conquer algorithm

Complexity

f (n) = A · n + f (n2) + f (n2)

Page 96: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Divide & conquer algorithm

Complexity

f (n) = A · n + f (n2) + f (n2)

= O(n log n)

Page 97: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Divide & conquer algorithm

Complexity

f (n) = A · n + f (n2) + f (n2)

= O(n log n)

Balanced partition

Divide and merge in O(n)

(preprocessing in O(n log n)

Page 98: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

CHAN’s ALGORITHM

Page 99: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

CHAN’s ALGORITHMCompute the CH of k subsets of P

Page 100: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

CHAN’s ALGORITHMWrap around the CH of the k subsets

Page 101: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

CHAN’s ALGORITHMCompute the CH of k = n/m subsets of size m:

each in O(m logm), all in k/m×O(m logm) = O(n logm)

Page 102: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

CHAN’s ALGORITHM

Find the si: O(n)

Compute the CH of k = n/m subsets of size m:each in O(m logm), all in k/m×O(m logm) = O(n logm)

Page 103: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

CHAN’s ALGORITHM

One wrapping step:find the bitangents ti on eachsubset:n/m+ O(nb points visited)=n/m+ O(nb points removed)

Page 104: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

CHAN’s ALGORITHM

Find the si: O(n)

Compute the CH of k = n/m subsets of size m:each in O(m logm), all in k/m×O(m logm) = O(n logm)

One wrapping step:find the bitangents ti on eachsubset:n/m + O(nb points visited)=n/m + O(nb points removed)

For h wrapping steps:O(hn/m+ total points removed)

= O(hn/m + n)

Total:O(n logm + hn/m + n) =O(n(1 + h/m + logm))

Page 105: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

CHAN’s ALGORITHMSet a parameter H, call h the actual size of the convex hull of P

Hull(P,m,H)Do H wrapping steps

If the last wrap comes back to the first point then return successElse return incomplete

• Success if H > h• Complexity of Hull(P,H,H) is O(n logH)

Page 106: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

CHAN’s ALGORITHMSet a parameter H, call h the actual size of the convex hull of P

Hull(P,m,H)Do H wrapping steps

If the last wrap comes back to the first point then return successElse return incomplete

• Success if H > h• Complexity of Hull(P,H,H) is O(n logH)

Hull(P)For i = 1, 2, ... doL = Hull(P,H,H) with m = H = min(22i , n)If L 6= incomplete then return L

Complexity:Nb of iterations = O(log log h)Cost of ith iterations = O(n logH) = O(n2i)

Total: O(∑log logn

i=1 n2i) = O(n2log logn+1) =O(n log h)

Page 107: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

Page 108: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

already seen: monotone polyline in Graham’s scan

Page 109: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

Graham does not work

Page 110: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

Graham does not work

Page 111: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

Graham does not work

Page 112: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

Graham does not work

Page 113: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

Graham does not work

Page 114: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

Graham does not work

Page 115: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

Graham does not work

Page 116: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

Graham does not work

Page 117: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

p1

p2

p3

p4

p6

p5

p8p10

p11

p12p13

p14

P Q

P = p1, p2, ..., p14Q contains the subsequence p2, p4, p6, p11

Page 118: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

p1

succ(AM)

pi−1

pi

AM

Incremental algorithm : order given by the polylineAM = highest rank point in CH(Pi−1)

Property: pi interior to CH(Pi−1) iff pi ∈ H+pred ∩H+

succ

pred(AM)

H+succ

H+pred

Page 119: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

Special case: simple polygonal line

p1

succ(AM)

pi−1

pi

AM

Incremental algorithm : order given by the polylineAM = highest rank point in CH(Pi−1)

Property: pi interior to CH(Pi−1) iff pi ∈ H+pred ∩H+

succ

Update CH(Pi) as in the incremental algorithm

Complexity: O(n)

pred(AM)

H+succ

H+pred

Page 120: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 121: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 122: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 123: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 124: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 125: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 126: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 127: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 128: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 129: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 130: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 131: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 132: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 133: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 134: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 135: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 136: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 137: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Page 138: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D: Gift wrapping

Complexity: O(nh)

Page 139: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithm

Page 140: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithm

Sort in x and divide

Page 141: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithm

Page 142: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmFind new edge: construct the CH of the projections,

use the 2d algo for bitangent

Page 143: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmUse a wrapping algorithm around the new edges

Page 144: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmUse a wrapping algorithm around the new edges

Page 145: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmSearch only in the star of the new edge vertices

Page 146: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmSearch only in the star of the new edge vertices

Page 147: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmSearch only in the star of the new edge vertices

Page 148: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmSearch only in the star of the new edge vertices

Page 149: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmSearch only in the star of the new edge vertices

Page 150: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmSearch only in the star of the new edge vertices

Page 151: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmSearch only in the star of the new edge vertices Merge in O(n)

Page 152: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest

3D Divide & conquer algorithmSearch only in the star of the new edge vertices Merge in O(n)

Complexity: O(n log n)

Page 153: Convex Hulls in 2d and 3d · 2013. 1. 28. · Convex Hulls in 2d and 3d. Extreme point. Extreme point Support line. Jarvis march (Gift wrapping) Jarvis march (Gift wrapping) The lowest