コード例 #1
0
  protected void processPosition(
      SortedPositionList<BorePoint> borePointList, BorePointInterface currentPosition) {
    // Update bore radius at hole
    // At this stage, the hole must be between the first and second bore
    // point
    Iterator<BorePoint> points = borePointList.iterator();
    BorePoint leftPoint = points.next();
    BorePoint rightPoint = points.next();

    double leftPosition = leftPoint.getBorePosition();
    double rightPosition = rightPoint.getBorePosition();
    double thisPosition = currentPosition.getBorePosition();
    double holeRelativePosition = (thisPosition - leftPosition) / (rightPosition - leftPosition);

    double leftDiameter = leftPoint.getBoreDiameter();
    double rightDiameter = rightPoint.getBoreDiameter();
    double holeBoreDiameter = leftDiameter + (rightDiameter - leftDiameter) * holeRelativePosition;
    currentPosition.setBoreDiameter(holeBoreDiameter);

    // Make new bore section
    if (rightPosition > thisPosition) {
      rightPoint = new BorePoint();
      rightPoint.setBoreDiameter(holeBoreDiameter);
      rightPoint.setBorePosition(thisPosition);
      borePointList.add(rightPoint);
    }
    addSection(leftPoint, rightPoint);
    borePointList.remove(leftPoint);
  }