allowInsertRemove = allowIR;
triedIR = false;
validate(pcp.getPipeRun());
+ if (pcp.getParentPoint() != null)
+ pcp = pcp.getParentPoint();
if (pcp.asPathLegEnd()) {
updatePathLegEndControlPoint(pcp); // FIXME: Rules won't work properly, if they are not run twice.
//updatePathLegEndControlPoint(pcp);
}
@SuppressWarnings("unused")
- private static boolean calculateOffset(Vector3d startPoint, Vector3d endPoint, ArrayList<PipeControlPoint> list, Vector3d dir, Vector3d offset) {
+ private static boolean calculateOffset(Vector3d startPoint, Vector3d endPoint, PipeControlPoint start, ArrayList<PipeControlPoint> list, PipeControlPoint end, Vector3d dir, Vector3d offset) {
boolean hasOffsets = false;
List<PipeControlPoint> offsets = new ArrayList<PipeControlPoint>(list.size());
+ // Only start offset affects the calculation
+ if (start.isOffset())
+ offsets.add(start);
for (PipeControlPoint icp : list) {
if (icp.isOffset()) {
offsets.add(icp);
Vector3d startPoint = start.getWorldPosition();
Vector3d endPoint = end.getWorldPosition();
Vector3d dir = new Vector3d();
- hasOffsets = calculateOffset(startPoint, endPoint, list, dir, offset);
+ hasOffsets = calculateOffset(startPoint, endPoint, start, list, end, dir, offset);
+ System.out.println();
return new UpdateStruct2(start, startPoint, list, end, endPoint, dir, offset, hasOffsets, iter, direction == Direction.PREVIOUS, toRemove, updated);
}
Vector3d ep = new Vector3d(end);
ep.sub(u.offset);
-
+ if (u.start.isOffset()) {
+ Vector3d offset = u.start.getSizeChangeOffsetVector(u.dir);
+ updateOffsetPoint(u.start, offset);
+ sp.add(offset);
+ ep.add(offset);
+ }
+
for (PipeControlPoint icp : u.list) {
updateInlineControlPoint(icp, sp, ep, u.dir);
if (icp.isOffset()) {
// FIXME : extra loop (dir should be calculated here)
Vector3d dir = new Vector3d();
Vector3d offset = new Vector3d();
- hasOffsets = calculateOffset(startPoint, endPoint, list, dir, offset);
+ hasOffsets = calculateOffset(startPoint, endPoint, start, list, end, dir, offset);
ppNoOffset(new UpdateStruct2(start, startPoint, list, end, endPoint, dir, null, hasOffsets, iter, reversed, toRemove, updated));
}
List<PipeControlPoint> points = getControlPoints(pipeRun);
PipeControlPoint pcp = points.get(0);
if (pcp.isSizeChange() && pcp.getChildPoints().size() > 0) {
- pipeRun = pcp.getPipeRun();
+ PipeRun pr = pcp.getPipeRun();
+ if (pr != pipeRun)
+ pipeRun = pr;
+ else break;
} else {
break;
}