Skip to content

Commit

Permalink
Merge branch 'main' into voltage_level_filter_whole_network
Browse files Browse the repository at this point in the history
  • Loading branch information
So-Fras authored Jan 25, 2024
2 parents e412247 + ed24436 commit 5d8401e
Show file tree
Hide file tree
Showing 48 changed files with 7,750 additions and 7,752 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public class ForceLayout<V, E> {
/** Deterministic randomness */
private final Random random = new Random(3L);

private static final int DEFAULT_MAX_STEPS = 1000;
private static final int DEFAULT_MAX_STEPS = 400;
private static final double DEFAULT_MIN_ENERGY_THRESHOLD = 0.001;
private static final double DEFAULT_DELTA_TIME = 1;
private static final double DEFAULT_DELTA_TIME = 0.1;
private static final double DEFAULT_REPULSION = 800.0;
private static final double DEFAULT_FRICTION = 500;
private static final double DEFAULT_MAX_SPEED = 100;
Expand Down Expand Up @@ -146,14 +146,12 @@ public ForceLayout<V, E> setFixedNodes(Set<V> fixedNodes) {
}

private void initializePoints() {
int nbUnknownPositions = graph.vertexSet().size() - initialPoints.size();

// instead of generating initial points in the [0,1] interval apply a scale depending on the number of unknown positions
double scale = Math.sqrt(nbUnknownPositions) * 5;
for (V vertex : graph.vertexSet()) {
Point p;
if (initialPoints.containsKey(vertex)) {
p = initialPoints.get(vertex);
} else {
p = new Point(random.nextDouble(), random.nextDouble());
}
points.put(vertex, p);
points.put(vertex, initialPoints.getOrDefault(vertex, new Point(scale * random.nextDouble(), scale * random.nextDouble())));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void setEdgeVisibility(Node node, BranchEdge branchEdge, BranchEdge.Side
}

private void computeSize(Graph graph) {
double[] dims = new double[4];
double[] dims = new double[] {Double.MAX_VALUE, -Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE};
Stream.concat(graph.getTextNodesStream(), graph.getNodesStream()).forEach(node -> {
dims[0] = Math.min(dims[0], node.getX());
dims[1] = Math.max(dims[1], node.getX());
Expand Down
60 changes: 30 additions & 30 deletions network-area-diagram/src/test/resources/3wt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 30 additions & 30 deletions network-area-diagram/src/test/resources/3wt_disconnected.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5d8401e

Please sign in to comment.