System.out.println("PipingRules.updateInlineControlPoint() " + pcp);
PipeControlPoint start = pcp.findPreviousEnd();
updatePathLegNext(start, pcp, PathLegUpdateType.NONE);
+
+ if (pcp.isOffset()) {
+ // Adjusting the rotation angle of an offset component may change variable angle turns
+ PipeControlPoint end = pcp.findNextEnd();
+ if (end.isVariableAngle()) {
+ updatePathLegNext(end, end, PathLegUpdateType.NONE);
+ }
+ if (start.isVariableAngle()) {
+ updatePathLegPrev(start, start, PathLegUpdateType.NONE);
+ }
+ }
}
private static PipeControlPoint insertElbow(PipeControlPoint pcp1, PipeControlPoint pcp2, Vector3d pos) throws Exception{
continue;
double curr = gapObj.d;
int d = 1;
- while (curr < -MIN_INLINE_LENGTH) {
+ while (d < gaps.size() && curr < -MIN_INLINE_LENGTH) {
GapObj next = i+d >= 0 ? gaps.get(i+d) : null;
GapObj prev = i-d >= 0 ? gaps.get(i-d) : null;
if (next != null && next.gap == Gap.SPACE) {
pcp.first.setWorldPosition(p);
}
}
- if (curr < -MIN_INLINE_LENGTH && prev != null && prev.gap == Gap.SPACE) {
+ else if (prev != null && prev.gap == Gap.SPACE) {
double move = Math.min(-curr, prev.d);
curr+= move;
- next.d -= move;
- if (next.d < MIN_INLINE_LENGTH)
- next.gap = Gap.ATTACHED;
+ prev.d -= move;
+ if (prev.d < MIN_INLINE_LENGTH)
+ prev.gap = Gap.ATTACHED;
Vector3d mv = new Vector3d(dir);
mv.normalize();
mv.scale(-move);
pcp.first.setWorldPosition(p);
}
}
+ else {
+ d++;
+ }
}
}
} else {
while (iter > 0) {
Vector3d tp = new Vector3d(dir);
tp.scaleAdd(curr, dp);
- tcp.setPosition(tp);
+ tcp._setPosition(tp); // no firing of listeners here
if (other == ne) {
dir2 = pathLegDirection(tcp);
} else {
}
}
finally {
- tcp.setPosition(tp0);
+ tcp._setPosition(tp0); // return the original value
}
return curr;
}
return Math.PI; // FIXME : argh
}
- Quat4d q = PipeControlPoint.getControlPointOrientationQuat(dir, tcp.getRotationAngle() != null ? tcp.getRotationAngle() : 0.0);
+ Quat4d q = tcp.getControlPointOrientationQuat(dir, tcp.getRotationAngle() != null ? tcp.getRotationAngle() : 0.0);
Vector3d v = new Vector3d();
MathTools.rotate(q, MathTools.Y_AXIS,v);
tcp.setTurnAxis(v);