* Updates tool graphics for current point
*/
private void updateCurrentPoint() {
-// PipeComponentProvider.createStraightEdges(pipeShapes.get(pipeShapes.size() - 1), controlPoints.get(controlPoints.size() - 1), currentPoint, pipeDiameter*0.5);
InlineComponent straight = (InlineComponent)added.get(added.size()-1);
- // FIXME : does not take account space the the previous elbow reserves.
+ // TODO: the inline length is from previous update step.
+ double l = straight.getPrevious().getControlPoint().getInlineLength();
Vector3d v = new Vector3d();
v.sub(currentPosition, previousPosition);
double length = v.length();
- v.scale(0.5);
- v.add(previousPosition);
- straight.getControlPoint().setWorldPosition(v);
- straight.getControlPoint().setLength(length);
+ if (length > MathTools.NEAR_ZERO) {
+ v.scale(1.0/length);
+ v.scale(0.5*(length+l));
+ v.add(previousPosition);
+ straight.getControlPoint().setWorldPosition(v);
+ straight.getControlPoint().setLength(length);
+ }
try {
PipingRules.positionUpdate(straight.getControlPoint(),false);
} catch (Exception e) {