X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.debug.graphical%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fgraphical%2Flayout%2FBarnesHut.java;fp=bundles%2Forg.simantics.debug.graphical%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fgraphical%2Flayout%2FBarnesHut.java;h=0000000000000000000000000000000000000000;hb=58a208e96edcddb07af89796859416dc6fc59f14;hp=ef54c25f7105b8efc108057f13271ff5afc24470;hpb=b29a69792f689d2ac7beffb725c814aa65fca301;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/layout/BarnesHut.java b/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/layout/BarnesHut.java deleted file mode 100644 index ef54c25f7..000000000 --- a/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/layout/BarnesHut.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.simantics.debug.graphical.layout; - -public class BarnesHut { - - static class Bounds { - final double minX; - final double minY; - final double maxX; - final double maxY; - - public Bounds(double minX, double minY, double maxX, double maxY) { - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - } - } - - private static Bounds computeOctreeBounds(double[] posX, double[] posY) { - double minX = posX[0]; - double minY = posY[0]; - double maxX = posX[0]; - double maxY = posY[0]; - - for(int i=1;i maxX) - maxX = x; - if(y < minY) - minY = y; - else if(y > maxY) - maxY = y; - } - - double diff = (maxX - minX) - (maxY - minY); - diff *= 0.5; - if(diff > 0.0) { - minY -= diff; - maxY += diff; - } - else { - minX += diff; - maxX -= diff; - } - return new Bounds(minX, minY, maxX, maxY); - } - - private static class VecRef { - double x; - double y; - } - - /*private static void force(VecRef f, double x1, double y1, double x2, double y2) { - double dx = x2 - x1; - double dy = y2 - y1; - double l2 = dx*dx + dy*dy; - double s = Q / l2; - f.x -= s * dx; - f.y -= s * dy; - } - - private static void forceNear(VecRef f, double x1, double y1, OctreeNode node, double[] posX, double[] posY) { - if(node instanceof OctreeLeaf) { - for(int id : ((OctreeLeaf)node).ids) { - force(f, x1, y1, posX[id], posY[id]); - } - } - else { - OctreeInnerNode inner = (OctreeInnerNode)node; - forceNear(f, x1, y1, inner.n00, posX, posY); - forceNear(f, x1, y1, inner.n10, posX, posY); - forceNear(f, x1, y1, inner.n01, posX, posY); - forceNear(f, x1, y1, inner.n11, posX, posY); - } - } - - private static void forceFar(VecRef f, double x1, double y1, OctreeNode node) { - double dx = node.massCenterX - x1; - double dy = node.massCenterY - y1; - double l2 = dx*dx + dy*dy; - double s = Q * node.mass / l2; - f.x -= s * dx; - f.y -= s * dy; - } - - private static void computeForce(OctreeNode octree, - ArrayList farNodes, - ArrayList nearNodes, - double[] posX, double[] posY, - double[] forceX, double[] forceY) { - VecRef f = new VecRef(); - if(octree instanceof OctreeLeaf) { - int[] ids = ((OctreeLeaf)octree).ids; - for(int i=0;i(), new ArrayList(), posX, posY, forceX, forceY); - }*/ - -}