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); }
protected double makeSections(SortedPositionList<BorePoint> borePointList, double rightPosition) { SortedPositionList<BorePoint> unprocessedPoints = borePointList.headList(rightPosition); if (unprocessedPoints.size() > 1) { Iterator<BorePoint> points = unprocessedPoints.iterator(); BorePoint leftPoint = points.next(); for (; points.hasNext(); ) { BorePoint rightPoint = points.next(); addSection(leftPoint, rightPoint); borePointList.remove(leftPoint); leftPoint = rightPoint; } } return rightPosition; }