You are given the vertices of a convex polygon in clockwise order. As you traverse the boundary in the given order, your heading adjusts toward your right at each vertex by more than 0 but less than 180 degrees. As you
complete the circuit by going from the last vertex to the first vertex and then
heading toward the second vertex, your
total heading adjustment has been 360 degrees.
We want to increase the size of the given convex polygon by picking some of its vertices
and moving them. We are not allowed to choose vertices that are adjacent to each
other, and we are not allowed to move a chosen vertex a distance of more than 1.
Of course the boundary segments between a moved vertex and its fixed adjacent vertices
also move -- we require that moving boundary segments never
intersect any other boundary segments. This guarantees
that we will end up with a polygon (possibly not convex) that has
a well-defined interior and exterior.
Create a class PolyMove that contains a method
addedArea that is given the sequence of vertices of a convex polygon in int[]s
x and y. It returns
the greatest increase in area that can be achieved by choosing and moving vertices.
The coordinates of the i-th vertex are given by the i-th elements of x and y.
There is a boundary segment between the last vertex and first vertex.
|