Polygon's element operator 'Polygon[i]' is currently returning a const
reference. This can be frustrating.
= Reason for current behavior =
Polygon keeps track of the radius of the polygon by determining which
vertex has the greatest magnitude. It is updated whenever addVertex,
addPoint, or setVertex is called. The element operator is const
because there's no way for us to know to update the radius.
= How we can change it =
We can add the updateRadius() function ( or just update(), ala
BatchGeometry ) which will step through each vector in the vertex list
and update the radius. The user will have to call this after modifying
any vector with the element operator. We can leave the current
functionality in addVertex, addPoint, and setVertex.
= What isn't pretty =
Having to call updateRadius() after modifying the polygon, but this is
a small trade-off for the alternative to doing "poly.setVertex( i,
poly.getVertex( i ) + displacement );". The only issue is that it's
easy to forget to update, but radius isn't currently used internally
at all, it used to be used for circle-circle testing for polygon
collision in PhoenixGL.