src/tools/FreehandRoiSculptorTool.js
/**
   * Merges points given a list of close pairs. The points are merged in an
   * iterative fashion to prevent generating a singularity in some edge cases.
   *
   * @private
   * @param {Array} closePairs - An array of pairs of handle indicies.
   * @returns {void}
   */
Merges points given a list of close pairs. The points are merged in an
iterative fashion to prevent generating a singularity in some edge cases.

@private
@param {Array} closePairs - An array of pairs of handle indicies.
@returns {void}
Merges points given a list of close pairs . The points are merged in an iterative fashion to prevent generating a singularity in some edge cases . @private @param { Array } closePairs - An array of pairs of handle indicies . @returns { void }
_mergeCloseHandles(closePairs) {
    let removedIndexModifier = 0;
    for (let i = 0; i < closePairs.length; i++) {
      const pair = this.constructor._getCorrectedPair(
        closePairs[i],
        removedIndexModifier
      );
      this._combineHandles(pair);
      removedIndexModifier++;
    }
    const newClosePairs = this._findCloseHandlePairs();
    if (newClosePairs.length) {
      this._mergeCloseHandles(newClosePairs);
    }
  }
_mergeCloseHandles ( closePairs ) { let removedIndexModifier = 0 ; for ( let i = 0 ; i < closePairs . length ; i ++ ) { const pair = this . constructor . _getCorrectedPair ( closePairs [ i ] , removedIndexModifier ) ; this . _combineHandles ( pair ) ; removedIndexModifier ++ ; } const newClosePairs = this . _findCloseHandlePairs ( ) ; if ( newClosePairs . length ) { this . _mergeCloseHandles ( newClosePairs ) ; } }
Merges points given a list of close pairs.
Merges points given a list of close pairs .
// Recursively remove problem childs