Пример #1
0
  /**
   * Given corner should be fully linked into the network. Needs to be removed as it connects two
   * parallel faces. We remove toAdd.nextL
   */
  private void removeCorner(Corner toAdd) {
    if (holdRemoves) {
      removes.add(toAdd);
      return;
    }

    // update corners
    toAdd.prevC.nextC = toAdd.nextC;
    toAdd.nextC.prevC = toAdd.prevC;

    // update edges
    toAdd.nextC.prevL = toAdd.prevL;

    // update main corner list
    skel.liveCorners.remove(toAdd);

    // brute force search for all references to old edge (if this was on a
    // per face basis it'd be much nicer)
    for (Corner lc : skel.liveCorners) {
      if (lc.nextL == toAdd.nextL) {
        lc.nextL = toAdd.prevL;
      }
      if (lc.prevL == toAdd.nextL) {
        lc.prevL = toAdd.prevL;
      }
    }

    if (toAdd.prevL != toAdd.nextL) {
      // update live edge list
      skel.liveEdges.remove(toAdd.nextL);

      // update output edge list (the two input edges give one output
      // face)
      // skel.inputEdges.remove(toAdd.nextL);

      // update edges's live corners
      for (Corner c : toAdd.nextL.currentCorners)
        if (toAdd.prevL.currentCorners.add(c)) ; // also adds toAdd.nextC
      // merge output corner lists

      // add to the results map likewise
      skel.output.merge(toAdd.prevC, toAdd); // toAdd.prevL.addOutputSidesFrom
      // (toAdd.nextL);

      // all collisions need recalculation. This situation could be
      // avoided if collisions occur strictly with infinite faces.
      // recurse through all consecutive colinear faces...?
      skel.refindAllFaceEventsLater();
    }

    // update edges's live corners (might have copied this over from nextL)
    toAdd.prevL.currentCorners.remove(toAdd);

    // todo: we've merged two machines! (pick an arbitrary one?)
    // assert ( toAdd.prevL.machine == toAdd.nextL.machine );
  }