calculating polygon bounding box