You will be given some two-dimensional vectors (the i-th element
of the int[]s dx and dy represent the
i-th vector (dx[i], dy[i])). Using some (or all) of
these in some order you may be able to construct a
polygon by appending them end to end - i.e., represent each vector
as an arrow, and place the arrows such that each arrow begins
where the last one ends. In order to get a polygon,
the last arrow must end at the beginning of the first arrow.
The image below shows an example with three vectors.
The left image shows the three vectors as arrows. We can start
with the red vector (2, 2), append the green vector (3, -4) and
finally append the blue vector (-5, 2) and we get the triangle
in the middle image.
We can also append them in a different order, starting again with
the red one, but appending first the blue one and finally the
green one, getting the triangle in the right image.
You are to find the convex polygon that you can
construct using some (or all) of the given vectors in some
order that has the maximum area, and return this area. If
you cannot construct a convex polygon using the given
vectors, return 0.0.
|