描述
The village's carpentry is located by a hill side. The carpenter's two little boys play with a piece of wood which looks like a deformed wheel with two identical convex polygon-shaped faces. One boy sets the wooden wheel on a slope at the hill top and let it roll down. The other boy is to quickly place himself at where he guesses the rolling wood would stop. Your program is to help him make the right guess.
More formally, we consider the wooden wheel as a simple convex polygon and we approximate the hill by a sequence of connected line segments with decreasing slopes. The slope of the last segment in the sequence is assumed to be zero, and the slope of the first segment is assumed to be a positive number. Initially, the wheel is placed on the hill such that there is at least one point of contact between the wheel and segments. For example in the following figure, the wheel in its initial position is drawn in solid lines, while the final position is drawn in dashed lines.
At any instant, the wheel rotates around one of its vertices, say P, if the y-coordinate of its center of gravity is decreased (note that this condition is necessary at any instant during the motion). It can be easily shown that at any instant, there is at most one such vertex. Rotation around P is stopped when the wheel touches a segment. The motion continues until no vertex can be found such that the wheel can rotate around it. At any instant, assume that changing the position of the center of gravity in any direction for at most 10-5 units, does not affect the stability of the wheel. Also assume that the friction between the wheel and the surface of the hill is so high that the wheel never slides on the surface.
这个村子的木工厂坐落在山边。木匠的两个小男孩在玩一块木头,这块木头看起来像一个变形的轮子,有两个相同的凸多边形面。一个男孩把木轮放在山顶的斜坡上,让它滚下来。另一个男孩快速地把自己放在他猜想的滚动的木头会停止的地方。你的计划是帮助他做出正确的猜测。更正式地说,我们认为木轮是一个简单的凸多边形,我们通过一系列连接的线段与斜率递减的山近似。序列中最后一段的斜率假设为零,第一段的斜率假设为正数。最初,车轮被放置在山丘上,以便在车轮和部件之间至少有一个接触点。例如,在下图中,轮子的初始位置是用实线描绘的,而最终位置是用虚线描绘的。在任何时刻,轮子都会绕着它的一个顶点旋转,比如说 P,如果它的重心的 y 坐标减小的话(注意,这个条件在运动过程中的任何时刻都是必要的)。可以很容易地