Index: ManhattanConnectionRouter.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/ManhattanConnectionRouter.java,v retrieving revision 1.9 diff -u -r1.9 ManhattanConnectionRouter.java --- ManhattanConnectionRouter.java 30 Mar 2005 21:27:45 -0000 1.9 +++ ManhattanConnectionRouter.java 22 Oct 2008 15:16:05 -0000 @@ -299,6 +299,11 @@ Ray startNormal = getStartDirection(conn); Ray endNormal = getEndDirection(conn); + // Those are used to keep the proper part of a vector (horizontal or vertical) using + // a dot product without changing direction of result. + Ray startOrientation = new Ray(Math.abs(startNormal.x), Math.abs(startNormal.y)); + Ray endOrientation = new Ray(Math.abs(endNormal.x), Math.abs(endNormal.y)); + List positions = new ArrayList(5); boolean horizontal = startNormal.isHorizontal(); if (horizontal) @@ -314,7 +319,7 @@ } else { // 2 if (startNormal.dotProduct(direction) < 0) - i = startNormal.similarity(start.getAdded(startNormal.getScaled(10))); + i = startOrientation.dotProduct(start.getAdded(startNormal.getScaled(10))); else { if (horizontal) i = average.y; @@ -325,7 +330,7 @@ horizontal = !horizontal; if (endNormal.dotProduct(direction) > 0) - i = endNormal.similarity(end.getAdded(endNormal.getScaled(10))); + i = endOrientation.dotProduct(end.getAdded(endNormal.getScaled(10))); else { if (horizontal) i = average.y; @@ -339,15 +344,15 @@ if (startNormal.dotProduct(endNormal) > 0) { //1 if (startNormal.dotProduct(direction) >= 0) - i = startNormal.similarity(start.getAdded(startNormal.getScaled(10))); + i = startOrientation.dotProduct(start.getAdded(startNormal.getScaled(10))); else - i = endNormal.similarity(end.getAdded(endNormal.getScaled(10))); + i = endOrientation.dotProduct(end.getAdded(endNormal.getScaled(10))); positions.add(new Integer(i)); horizontal = !horizontal; } else { //3 or 1 if (startNormal.dotProduct(direction) < 0) { - i = startNormal.similarity(start.getAdded(startNormal.getScaled(10))); + i = startOrientation.dotProduct(start.getAdded(startNormal.getScaled(10))); positions.add(new Integer(i)); horizontal = !horizontal; } @@ -360,7 +365,7 @@ horizontal = !horizontal; if (startNormal.dotProduct(direction) < 0) { - i = endNormal.similarity(end.getAdded(endNormal.getScaled(10))); + i = endOrientation.dotProduct(end.getAdded(endNormal.getScaled(10))); positions.add(new Integer(i)); horizontal = !horizontal; }