Mirrored Tree Part II


Hi Guys,
I have created a mirrored tree using the following principle:
Create a network of all the nodes in the document, a tree will occupy one layer, soo two trees occupy two layers, when performLayout on our MirroredTree Class is called, it creates two futher layouts (one on each layer) Both of the trees are layed out and moved so that they face one another.
My question is that there can be links between these two trees that are not used in the layout (so not to get the algo to cross tree boundaries). However these links can be congurent and one on top of the other. <-That is the problem. When we use GoLayoutLayeredDigraph any congruent links have a nice kink in them. How can we get the kink into our links.
Our Mirrored Tree is subclassed from GoLayoutLayeredDigraph, as I thought I might be able to force the layout the links that we want to have a kink in.


Hi All,
I took a little time away from this problem and came back to it today and have solved.
Here is a brief overview just incase anyone else wants to know in the future. :)
int currentCongruentLinkCount=0;
//There are only Special Links in the Link Layer
foreach(SpecialLink g2 in this.Document.LinksLayer)
//Compare against each other Link
foreach(RuleLink g3 in this.Document.LinksLayer)
//We don’t want to look at the same link, or ones already bent
if((!g2.Equals(g3)) && g2.RealLink.PointsCount == 2 && g3.RealLink.PointsCount == 2)
if(Math.Abs(((g3.RealLink.Bounds.Bottom - g3.RealLink.Bounds.Top)/(g3.RealLink.Bounds.Right - g3.RealLink.Bounds.Left)) - ((g2.RealLink.Bounds.Bottom - g2.RealLink.Bounds.Top)/(g2.RealLink.Bounds.Right - g2.RealLink.Bounds.Left))) <0.1 )
//The diffenrece in gradients is < 0.1 i.e they are parralell
//Are the close to each other
RectangleF linkBounds = g2.RealLink.Bounds;
//The Lines are very close and are nearly paralell so add in a point have the links either side of the central link, going futher out each side

double xdist=0.0;
double ydist=0.0;
double angle;
double theta1;
double theta2;
double offsetAngle;
angle=Math.Atan(50/(g2.RealLink.Width/2.0f)) * (180/Math.PI);
// angle in degrees
theta2=180.0f - angle - 90.0f;
theta1=180.0f- angle - theta2;
offsetAngle = 90 +theta1;

if(currentCongruentLinkCount % 2==0)
xdist=Math.Sin( offsetAngle * (Math.PI/180)) * 50;
ydist=Math.Cos(offsetAngle * (Math.PI/180)) * 50;
xdist=Math.Sin( -offsetAngle * (Math.PI/180)) * 50;
ydist=Math.Cos(-offsetAngle * (Math.PI/180)) * 50;
g2.RealLink.InsertPoint(g2.RealLink.PointsCount-1, new PointF(g2.RealLink.Center.X + ((float) xdistcurrentCongruentLinkCount+1)), g2.RealLink.Center.Y + ((float)ydist currentCongruentLinkCount+1))));