One interesting geometry problem...... Help me to solve it
Moderator: Board moderators
-
- New poster
- Posts: 3
- Joined: Sun Jul 27, 2003 7:12 pm
- Location: Kazakhstan, Almaty
One interesting geometry problem...... Help me to solve it
Here it is.
If you had n segments on plane, from which you can construct a polygon. Find algorithm to construct polygon with maximal area.
If you had n segments on plane, from which you can construct a polygon. Find algorithm to construct polygon with maximal area.
Last edited by maratkalibek on Wed Oct 08, 2003 11:03 am, edited 2 times in total.
-
- New poster
- Posts: 3
- Joined: Sun Jul 27, 2003 7:12 pm
- Location: Kazakhstan, Almaty
-
- Experienced poster
- Posts: 202
- Joined: Fri Mar 22, 2002 2:00 am
- Location: Chittagong. CSE - CUET
- Contact:
Re: One interesting geometry problem......
Can there be any loop inside polygon? I mean is there any line segment intersect?maratkalibek wrote:Here it is.
If you had n segments on plane, from which you can construct a polygon. Find algorithm to construct polygon with maximal area.
Or it will be a convex polygon???

-
- New poster
- Posts: 3
- Joined: Sun Jul 27, 2003 7:12 pm
- Location: Kazakhstan, Almaty
-
- Learning poster
- Posts: 53
- Joined: Sat Jan 24, 2004 9:22 pm
- Location: Tomsk, Siberia, RUSSIA
- Contact:
OK there is such a problem on Timus site.
The idea of solving it is that the area of a poligon is maximum when there can be a circle drawn around it. I dont know how to prove that. Well circle is a curve that provides maximum area for a given perimeter, so you are kinda building a polygon as "close" as possible to a circle.
So basicly it doesnt matter in what order you connect the segments. All you need to find is radius R. You can use binary search for that.
P.S. There was case i needed tto consider - when one side was pretty long and the rest were pretty short.
For example
3
5.0
2.6
2.6
I think there were some tricks about these cases.
The idea of solving it is that the area of a poligon is maximum when there can be a circle drawn around it. I dont know how to prove that. Well circle is a curve that provides maximum area for a given perimeter, so you are kinda building a polygon as "close" as possible to a circle.
So basicly it doesnt matter in what order you connect the segments. All you need to find is radius R. You can use binary search for that.
P.S. There was case i needed tto consider - when one side was pretty long and the rest were pretty short.
For example
3
5.0
2.6
2.6
I think there were some tricks about these cases.
The more contests are held, the happier I am.
-
- Experienced poster
- Posts: 187
- Joined: Wed Dec 11, 2002 2:03 pm
- Location: Mount Papandayan, Garut
-
- Learning poster
- Posts: 53
- Joined: Sat Jan 24, 2004 9:22 pm
- Location: Tomsk, Siberia, RUSSIA
- Contact:
To find R use binary search.
Lets say you are trying a current value of R = Rcur.
If our poligon has the circle drawn around it we have N triangles with Sides
[ RCur, RCur, A(i)A(i+1) ] you need to find angles between RCur and RCur and SUM THEM UP. If the sum is less then 2*pi then RCur is too big for our set of segments, otherwise R>=RCur. (And dont forget the tricky case, you ll need to make sure you re calculating the angle right).
Thats the condition you ll need to use in binary search.
Lets say you are trying a current value of R = Rcur.
If our poligon has the circle drawn around it we have N triangles with Sides
[ RCur, RCur, A(i)A(i+1) ] you need to find angles between RCur and RCur and SUM THEM UP. If the sum is less then 2*pi then RCur is too big for our set of segments, otherwise R>=RCur. (And dont forget the tricky case, you ll need to make sure you re calculating the angle right).
Thats the condition you ll need to use in binary search.
The more contests are held, the happier I am.
-
- Experienced poster
- Posts: 187
- Joined: Wed Dec 11, 2002 2:03 pm
- Location: Mount Papandayan, Garut
Thanks for spoiling the current task from the http://www.ginfo.ro/contest, I hope you will be able to implement it ...
I found a paper of Djikstra wich proves it with arguments from phisics (you can find it here http://www.cs.utexas.edu/users/EWD/index06xx.html document 693)