mayContainCircleCenter method

bool mayContainCircleCenter(
  1. CellLEC cell
)

Tests whether a cell may contain the circle center, and thus should be refined (split into subcells to be investigated further.)

@param cell the cell to test @return true if the cell might contain the circle center

Implementation

bool mayContainCircleCenter(CellLEC cell) {
  /**
   * Every point in the cell lies outside the boundary,
   * so they cannot be the center point
   */
  if (cell.isFullyOutside())
    return false;

  /**
   * The cell is outside, but overlaps the boundary
   * so it may contain a point which should be checked.
   * This is only the case if the potential overlap distance
   * is larger than the tolerance.
   */
  if (cell.isOutside()) {
    bool isOverlapSignificant = cell.getMaxDistance() > tolerance;
    return isOverlapSignificant;
  }

  /**
   * Cell is inside the boundary. It may contain the center
   * if the maximum possible distance is greater than the current distance
   * (up to tolerance).
   */
  double potentialIncrease = cell.getMaxDistance() - farthestCell.getDistance();
  return potentialIncrease > tolerance;
}