public static void setEnabled(boolean enabled) {
PipingRules.enabled = enabled;
- if(!enabled)
- currentUpdates.clear();
+ if(!enabled) {
+ synchronized (ruleMutex) {
+ currentUpdates.clear();
+ }
+ }
}
public static boolean isEnabled() {
scp.insert(pcp1, pcp2);
scp.setWorldPosition(pos);
+ Vector3d dir = new Vector3d();
+ dir.sub(pcp2.getWorldPosition(), pcp1.getWorldPosition());
+ updateControlPointOrientation(scp, dir);
scp.setLength(length);
validate(scp.getPipeRun());
return scp;
Vector3d dir = new Vector3d();
dir.sub(currentPos, prevPos);
- boolean simple = currentUpdates.contains(icp);
+ boolean simple;
+ synchronized (ruleMutex) {
+ simple = currentUpdates.contains(icp);
+ }
+
if (simple) {
// Update based on position -> adjust length
double currentLength = (dir.length() - prev.getInlineLength()) * 2.0;
PipeControlPoint dcp2 = u.end;
Point3d position1 = new Point3d(u.startPoint);
Point3d position2 = new Point3d(u.endPoint);
+
+ Vector3d dir = new Vector3d(), offset = new Vector3d();
+ calculateDirectedOffset(new Vector3d(position1), new Vector3d(position2), u.start, u.list, u.end, dir, offset);
+
Point3d position1offset = new Point3d(position1);
- position1offset.sub(u.offset);
+ position1offset.add(offset);
Point3d position2offset = new Point3d(position2);
- position2offset.add(u.offset);
+ position2offset.sub(offset);
Vector3d dir1 = direction(dcp1, Direction.NEXT);
Vector3d dir2 = direction(dcp2, Direction.PREVIOUS);
- Vector3d p1 = MathTools.closestPointOnStraight(position1offset, position2, dir2);
- Vector3d p2 = MathTools.closestPointOnStraight(position2offset, position1, dir1);
+
+ Vector3d p1 = MathTools.closestPointOnStraight(position1, position2offset, dir2);
+ Vector3d p2 = MathTools.closestPointOnStraight(position2, position1offset, dir1);
double d1 = position1.distance(new Point3d(p1));
double d2 = position2.distance(new Point3d(p2));
p1.add(v);
if (!u.reversed)
- p2 = MathTools.closestPointOnStraight(new Point3d(p1), position2, dir2);
+ p2 = MathTools.closestPointOnStraight(new Point3d(p1), position2offset, dir2);
else
- p2 = MathTools.closestPointOnStraight(new Point3d(p1), position1, dir1);
+ p2 = MathTools.closestPointOnStraight(new Point3d(p1), position1offset, dir1);
// By default, the elbows are placed next to each other, by using 90 deg angles.
// If the distance between elbows is not enough, we must move the other elbow (and create more shallow angle elbows)