private static boolean asDirected(PipeControlPoint pcp, Direction direction) {
if (pcp.isDirected())
return true;
- if (pcp.isTurn() && pcp.isFixed()) {
+ if (pcp.asFixedAngle()) {
if (!pcp._getReversed())
return direction == Direction.NEXT;
else
if (DEBUG)
System.out.println("PipingRules.updateFreePipeRun " + u + " " + lengthChange);
checkExpandPathLeg(u, lengthChange);
- if (u.start.isInline() || u.end.isInline() || u.start.isFixed() || u.end.isFixed())
+ if (u.start.isInline() || u.end.isInline() || u.start.asFixedAngle()|| u.end.asFixedAngle())
processPathLeg(u, true, false);
}
double distance = t.length();
boolean aligned = (distance < ALLOWED_OFFSET);
if (aligned) {
- if (u.start.isInline() || u.end.isInline() || u.start.isFixed() || u.end.isFixed())
+ if (u.start.isInline() || u.end.isInline() || u.start.asFixedAngle() || u.end.asFixedAngle())
processPathLeg(u, true, false);
checkExpandPathLeg(u, lengthChange, inlineEnd);
// TODO : this returns now space for 90 deg turn.
// The challenge: position of tcp affects the turn angle, which then affects the required space. Perhaps we need to iterate...
// Additionally, if the path legs contain offset, using just positions of opposite path leg ends is not enough,
- return tcp.getPipeRun().getTurnRadius();
+ return ((TurnComponent)tcp.getPipelineComponent()).getTurnRadius();
}
private static void insertElbowUpdate(UpdateStruct2 u, PipeControlPoint dcp, PipeControlPoint next, boolean dcpStart, Vector3d position, Vector3d directedDirection) throws Exception{
private static void updateEndComponentControlPoint(PipeControlPoint ecp, Vector3d start, Vector3d end) throws Exception {
if (DEBUG)
System.out.println("PipingRules.updateEndComponentControlPoint() " + ecp);
- // PipeControlPoint next = ecp.getNext();
- // PipeControlPoint prev = ecp.getPrevious();
- // if (next != null) {
- // end = G3DTools.getPoint(next.getLocalPosition());
- // start = G3DTools.getPoint(ecp.getLocalPosition());
- // } else if (prev != null) {
- // end = G3DTools.getPoint(ecp.getLocalPosition());
- // start = G3DTools.getPoint(prev.getLocalPosition());
- // } else {
- // // TODO : warning?
- // return;
- // }
- // Vector3d dir = new Vector3d (end);
- // dir.sub(start);
- // dir.normalize();
- // G3DTools.setTuple(ecp.getDirection(), dir);
- if (!ecp.isFixed())
- updateControlPointOrientation(ecp);
+ //FIXME : end control point cannot be fixed!
+ //if (!ecp.isFixed())
+ updateControlPointOrientation(ecp);
for (PipeControlPoint pcp : ecp.getSubPoint()) {
// TODO update position
}
}
- if (!tcp.isFixed()) {
+ if (!tcp.asFixedAngle()) {
if (next == null || prev == null) {
Vector3d turnAxis = new Vector3d();
turnAxis.cross(prev, next);
if (turnAxis.lengthSquared() > MathTools.NEAR_ZERO) {
- double elbowRadius = tcp.getPipelineComponent().getPipeRun().getTurnRadius();
+ double elbowRadius = ((TurnComponent)tcp.getPipelineComponent()).getTurnRadius();
double R = elbowRadius / Math.tan(angle * 0.5);
turnAxis.normalize();
}
}
- if (current.isTurn() && current.isFixed()) {
+ //if (current.isTurn() && current.isFixed()) {
+ if (current.asFixedAngle()) {
current.setReversed(!current._getReversed());
}
if (current.isInline() && current.isReverse()) {
}
public static void splitVariableLengthComponent(PipelineComponent newComponent, InlineComponent splittingComponent, boolean assignPos) throws Exception{
- assert(!splittingComponent.getControlPoint().isFixed());
- assert(!(newComponent instanceof InlineComponent && !newComponent.getControlPoint().isFixed()));
+ assert(!splittingComponent.getControlPoint().isFixedLength());
+ assert(!(newComponent instanceof InlineComponent && !newComponent.getControlPoint().isFixedLength()));
PipeControlPoint newCP = newComponent.getControlPoint();
PipeControlPoint splittingCP = splittingComponent.getControlPoint();
PipeControlPoint nextCP = splittingCP.getNext();