public Rectangle getBounds() {
   if (npoints == 0) return new Rectangle();
   if (bounds == null) calculateBounds(xpoints, ypoints, npoints);
   return bounds.getBounds();
 }