public boolean removePointAt(int x, int y) {
    if (type!=TYPE_POLY) return false;

    for (int i=0; i<poly.npoints; i++) {
      if (x>=poly.xpoints[i]-2 && x<=poly.xpoints[i]+2 &&
          y>=poly.ypoints[i]-2 && y<=poly.ypoints[i]+2) {
            remove_polypoint(i+1);
            return true;
          }
    }

    return false;
  }