private void removePoint(GeoElement oldPoint) {

    // remove dependent algorithms (e.g. segments) from update sets of
    // objects further up (e.g. polygon) the tree
    ArrayList<AlgoElement> algoList = oldPoint.getAlgorithmList();
    for (int k = 0; k < algoList.size(); k++) {
      AlgoElement algo = algoList.get(k);
      for (int j = 0; j < input.length; j++) input[j].removeFromUpdateSets(algo);
    }

    // remove old point
    oldPoint.setParentAlgorithm(null);

    // remove dependent segment algorithm that are part of this polygon
    // to make sure we don't remove the polygon as well
    GeoPolygon poly = getPoly();
    for (int k = 0; k < algoList.size(); k++) {
      AlgoElement algo = algoList.get(k);
      // make sure we don't remove the polygon as well
      if (algo instanceof AlgoJoinPointsSegmentInterface
          && ((AlgoJoinPointsSegmentInterface) algo).getPoly() == poly) {
        continue;
      }
      algo.remove();
    }

    algoList.clear();
    // remove point
    oldPoint.doRemove();
  }
 /** Calls doRemove() for all output objects of this algorithm except for keepGeo. */
 @Override
 public void removeOutputExcept(GeoElement keepGeo) {
   for (int i = 0; i < super.getOutputLength(); i++) {
     GeoElement geo = super.getOutput(i);
     if (geo != keepGeo) {
       if (geo.isGeoPoint()) {
         removePoint(geo);
       } else {
         geo.doRemove();
       }
     }
   }
 }