|
|
@ -60,6 +60,7 @@ public class GraphPlotter implements Cloneable {
|
|
|
|
this.bottommost = 1.0;
|
|
|
|
this.bottommost = 1.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Object clone() {
|
|
|
|
public Object clone() {
|
|
|
|
GraphPlotter g = new GraphPlotter();
|
|
|
|
GraphPlotter g = new GraphPlotter();
|
|
|
|
g.nodes.putAll(this.nodes);
|
|
|
|
g.nodes.putAll(this.nodes);
|
|
|
@ -95,6 +96,7 @@ public class GraphPlotter implements Cloneable {
|
|
|
|
this.layer = layer;
|
|
|
|
this.layer = layer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Object clone() {
|
|
|
|
public Object clone() {
|
|
|
|
return new Point(this.x, this.y, this.layer);
|
|
|
|
return new Point(this.x, this.y, this.layer);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -113,14 +115,15 @@ public class GraphPlotter implements Cloneable {
|
|
|
|
double f = attraction ? r.attraction * (d - r.length) * (d - r.length) : - r.repulsion * (r.length - d) * (r.length - d); // the force
|
|
|
|
double f = attraction ? r.attraction * (d - r.length) * (d - r.length) : - r.repulsion * (r.length - d) * (r.length - d); // the force
|
|
|
|
double x1 = Math.cos(a) * f;
|
|
|
|
double x1 = Math.cos(a) * f;
|
|
|
|
double y1 = Math.sin(a) * f;
|
|
|
|
double y1 = Math.sin(a) * f;
|
|
|
|
assert !(attraction && a < Math.PI) || y1 > 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;
|
|
|
|
// verify calculation
|
|
|
|
assert !(!attraction && a < Math.PI) || y1 < 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;
|
|
|
|
assert !(attraction && a < Math.PI) || y1 >= 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;
|
|
|
|
assert !(attraction && a > Math.PI) || y1 < 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;
|
|
|
|
assert !(!attraction && a < Math.PI) || y1 <= 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;
|
|
|
|
assert !(!attraction && a > Math.PI) || y1 > 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;
|
|
|
|
assert !(attraction && a > Math.PI) || y1 <= 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;
|
|
|
|
assert !(attraction && (a < p2 || a > p23)) || x1 > 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;
|
|
|
|
assert !(!attraction && a > Math.PI) || y1 >= 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;
|
|
|
|
assert !(!attraction && (a < p2 || a > p23)) || x1 < 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;
|
|
|
|
assert !(attraction && (a < p2 || a > p23)) || x1 >= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;
|
|
|
|
assert !(attraction && !(a < p2 || a > p23)) || x1 < 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;
|
|
|
|
assert !(!attraction && (a < p2 || a > p23)) || x1 <= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;
|
|
|
|
assert !(!attraction && !(a < p2 || a > p23)) || x1 > 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;
|
|
|
|
assert !(attraction && !(a < p2 || a > p23)) || x1 <= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;
|
|
|
|
|
|
|
|
assert !(!attraction && !(a < p2 || a > p23)) || x1 >= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;
|
|
|
|
calcPoint.x += x1;
|
|
|
|
calcPoint.x += x1;
|
|
|
|
calcPoint.y += y1;
|
|
|
|
calcPoint.y += y1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|