public boolean inside(int x, int y) {
    if (type == TYPE_RECT) {
      if (rect.contains(x,y)) return true;
    } else if (type == TYPE_CIRCLE) {
      int mr=(int)Math.sqrt( ( x - circle_center.x ) * ( x - circle_center.x ) +
                             ( y - circle_center.y ) * ( y - circle_center.y ) );
      if (mr<circle_r) return true;
    } else if (type == TYPE_POLY) {
      if (poly.contains(x,y)) return true;
    }
    return false;
  }