g***@pixelglow.com
2008-09-17 13:18:51 UTC
Does anybody have a good C/C++/Java implementation of a minimal
enclosing triangle for a (convex) polygon in O(n) time?
I tried implementing the one in "An Optimal Algorithm for Finding
Minimal Enclosing Triangles" (O'Rourke, Aggarwal, Maddila, Baldwin) in
Journal of Algorithms 7 (1986). After grinding my rusty mathematical
mental gears for a couple of days, I finally figured out enough to
start on an implementation only to get stuck at this point:
On page 265, the pseudocode goes
1. If [gamma(b), b] intersects P above b or height(b) < height(a-1)
2. then set side flush with [b-1, b] and
3. if midpoint of B < height(a-1)
4. then set side A to have midpoint a-1
5. else side B is determined by [gamma(b), b]
If line 1 is false, then line 5 is executed. At this stage, the
triangle is uniquely determined by the lines [c-1, c], [a-1, a] and
[gamma(b), b]. So far so good
If line 2 is true, then lines 2-4 are executed. At this stage, only
two sides of the triangle is determined i.e. [c-1, c], [b-1, b].
Qn:
A. If line 3 is false, how do we determine the third side?
B. If line 3 is true i.e. line 4 is executed, how do you arrange side
A to have midpoint a-1?
Notation:
[x, y] is the infinite line that contains points x and y
height(p) is the height of point p from [c-1, c]
gamma(p) is the point on [a-1, a] with height(gamma(p)) = 2 *
height(p)
Thanks for the help in advance!
Cheers,
Glen Low
Pixelglow Software
P.S. You can also reach me at glen dot low at pixelglow dot com.
enclosing triangle for a (convex) polygon in O(n) time?
I tried implementing the one in "An Optimal Algorithm for Finding
Minimal Enclosing Triangles" (O'Rourke, Aggarwal, Maddila, Baldwin) in
Journal of Algorithms 7 (1986). After grinding my rusty mathematical
mental gears for a couple of days, I finally figured out enough to
start on an implementation only to get stuck at this point:
On page 265, the pseudocode goes
1. If [gamma(b), b] intersects P above b or height(b) < height(a-1)
2. then set side flush with [b-1, b] and
3. if midpoint of B < height(a-1)
4. then set side A to have midpoint a-1
5. else side B is determined by [gamma(b), b]
If line 1 is false, then line 5 is executed. At this stage, the
triangle is uniquely determined by the lines [c-1, c], [a-1, a] and
[gamma(b), b]. So far so good
If line 2 is true, then lines 2-4 are executed. At this stage, only
two sides of the triangle is determined i.e. [c-1, c], [b-1, b].
Qn:
A. If line 3 is false, how do we determine the third side?
B. If line 3 is true i.e. line 4 is executed, how do you arrange side
A to have midpoint a-1?
Notation:
[x, y] is the infinite line that contains points x and y
height(p) is the height of point p from [c-1, c]
gamma(p) is the point on [a-1, a] with height(gamma(p)) = 2 *
height(p)
Thanks for the help in advance!
Cheers,
Glen Low
Pixelglow Software
P.S. You can also reach me at glen dot low at pixelglow dot com.