@Override public void apply(Node n, double g) { ForceAtlas2LayoutData nLayout = n.getLayoutData(); // Get the distance double xDist = n.x(); double yDist = n.y(); double distance = (float) Math.sqrt(xDist * xDist + yDist * yDist); if (distance > 0) { // NB: factor = force / distance double factor = coefficient * nLayout.mass * g / distance; nLayout.dx -= xDist * factor; nLayout.dy -= yDist * factor; } } }
@Override public void apply(Node n, double g) { ForceAtlas2LayoutData nLayout = n.getLayoutData(); // Get the distance double xDist = n.x(); double yDist = n.y(); double distance = (float) Math.sqrt(xDist * xDist + yDist * yDist); if (distance > 0) { // NB: factor = force / distance double factor = coefficient * nLayout.mass * g / distance; nLayout.dx -= xDist * factor; nLayout.dy -= yDist * factor; } } }
@Override public void apply(Node n, double g) { ForceAtlas2LayoutData nLayout = n.getLayoutData(); // Get the distance double xDist = n.x(); double yDist = n.y(); double distance = (float) Math.sqrt(xDist * xDist + yDist * yDist); if (distance > 0) { // NB: factor = force / distance double factor = coefficient * nLayout.mass * g; nLayout.dx -= xDist * factor; nLayout.dy -= yDist * factor; } } }
public static void fcBiFlatAttractor(Node N1, Node N2, double c) { double xDist = N1.x() - N2.x(); // distance en x entre les deux noeuds double yDist = N1.y() - N2.y(); double dist = (float) Math.sqrt(xDist * xDist + yDist * yDist); // distance tout court if (dist > 0) { double f = -c; ForceVectorNodeLayoutData N1L = N1.getLayoutData(); ForceVectorNodeLayoutData N2L = N2.getLayoutData(); N1L.dx += xDist / dist * f; N1L.dy += yDist / dist * f; N2L.dx -= xDist / dist * f; N2L.dy -= yDist / dist * f; } }
@Override public void apply(Node n1, Node n2, double e) { ForceAtlas2LayoutData n1Layout = n1.getLayoutData(); ForceAtlas2LayoutData n2Layout = n2.getLayoutData(); // Get the distance double xDist = n1.x() - n2.x(); double yDist = n1.y() - n2.y(); double distance = (float) Math.sqrt(xDist * xDist + yDist * yDist); if (distance > 0) { // NB: factor = force / distance double factor = -coefficient * e * Math.log(1 + distance) / distance; n1Layout.dx += xDist * factor; n1Layout.dy += yDist * factor; n2Layout.dx -= xDist * factor; n2Layout.dy -= yDist * factor; } } }
@Override public void apply(Node n1, Node n2, double e) { ForceAtlas2LayoutData n1Layout = n1.getLayoutData(); ForceAtlas2LayoutData n2Layout = n2.getLayoutData(); // Get the distance double xDist = n1.x() - n2.x(); double yDist = n1.y() - n2.y(); double distance = (float) Math.sqrt(xDist * xDist + yDist * yDist); if (distance > 0) { // NB: factor = force / distance double factor = -coefficient * e * Math.log(1 + distance) / distance / n1Layout.mass; n1Layout.dx += xDist * factor; n1Layout.dy += yDist * factor; n2Layout.dx -= xDist * factor; n2Layout.dy -= yDist * factor; } } }
@Override public void apply(Node n1, Node n2) { ForceAtlas2LayoutData n1Layout = n1.getLayoutData(); ForceAtlas2LayoutData n2Layout = n2.getLayoutData(); // Get the distance double xDist = n1.x() - n2.x(); double yDist = n1.y() - n2.y(); double distance = (float) Math.sqrt(xDist * xDist + yDist * yDist); if (distance > 0) { // NB: factor = force / distance double factor = coefficient * n1Layout.mass * n2Layout.mass / distance / distance; n1Layout.dx += xDist * factor; n1Layout.dy += yDist * factor; n2Layout.dx -= xDist * factor; n2Layout.dy -= yDist * factor; } }
public static void fcBiRepulsor_y(Node N1, Node N2, double c, double verticalization) { double xDist = N1.x() - N2.x(); // distance en x entre les deux noeuds double yDist = N1.y() - N2.y(); double dist = (float) Math.sqrt(xDist * xDist + yDist * yDist); // distance tout court if (dist > 0) { double f = repulsion(c, dist); ForceVectorNodeLayoutData N1L = N1.getLayoutData(); ForceVectorNodeLayoutData N2L = N2.getLayoutData(); N1L.dx += xDist / dist * f; N1L.dy += verticalization * yDist / dist * f; N2L.dx -= xDist / dist * f; N2L.dy -= verticalization * yDist / dist * f; } }
@Override public void apply(Node n1, Node n2, double e) { ForceAtlas2LayoutData n1Layout = n1.getLayoutData(); ForceAtlas2LayoutData n2Layout = n2.getLayoutData(); // Get the distance double xDist = n1.x() - n2.x(); double yDist = n1.y() - n2.y(); // NB: factor = force / distance double factor = -coefficient * e; n1Layout.dx += xDist * factor; n1Layout.dy += yDist * factor; n2Layout.dx -= xDist * factor; n2Layout.dy -= yDist * factor; } }
@Override public void apply(Node n1, Node n2, double e) { ForceAtlas2LayoutData n1Layout = n1.getLayoutData(); ForceAtlas2LayoutData n2Layout = n2.getLayoutData(); // Get the distance double xDist = n1.x() - n2.x(); double yDist = n1.y() - n2.y(); // NB: factor = force / distance double factor = -coefficient * e / n1Layout.mass; n1Layout.dx += xDist * factor; n1Layout.dy += yDist * factor; n2Layout.dx -= xDist * factor; n2Layout.dy -= yDist * factor; } }
public static void fcBiRepulsor(Node N1, Node N2, double c) { double xDist = N1.x() - N2.x(); // distance en x entre les deux noeuds double yDist = N1.y() - N2.y(); double dist = (float) Math.sqrt(xDist * xDist + yDist * yDist); // distance tout court if (dist > 0) { double f = repulsion(c, dist); ForceVectorNodeLayoutData N1L = N1.getLayoutData(); ForceVectorNodeLayoutData N2L = N2.getLayoutData(); N1L.dx += xDist / dist * f; N1L.dy += yDist / dist * f; N2L.dx -= xDist / dist * f; N2L.dy -= yDist / dist * f; } }
public static void fcBiAttractor(Node N1, Node N2, double c) { double xDist = N1.x() - N2.x(); // distance en x entre les deux noeuds double yDist = N1.y() - N2.y(); double dist = (float) Math.sqrt(xDist * xDist + yDist * yDist); // distance tout court if (dist > 0) { double f = attraction(c, dist); ForceVectorNodeLayoutData N1L = N1.getLayoutData(); ForceVectorNodeLayoutData N2L = N2.getLayoutData(); N1L.dx += xDist / dist * f; N1L.dy += yDist / dist * f; N2L.dx -= xDist / dist * f; N2L.dy -= yDist / dist * f; } }
@Override public void apply(Node n1, Node n2, double e) { ForceAtlas2LayoutData n1Layout = n1.getLayoutData(); ForceAtlas2LayoutData n2Layout = n2.getLayoutData(); // Get the distance double xDist = n1.x() - n2.x(); double yDist = n1.y() - n2.y(); double distance = Math.sqrt(xDist * xDist + yDist * yDist) - n1.size() - n2.size(); if (distance > 0) { // NB: factor = force / distance double factor = -coefficient * e * Math.log(1 + distance) / distance; n1Layout.dx += xDist * factor; n1Layout.dy += yDist * factor; n2Layout.dx -= xDist * factor; n2Layout.dy -= yDist * factor; } } }
@Override public void apply(Node n1, Node n2, double e) { ForceAtlas2LayoutData n1Layout = n1.getLayoutData(); ForceAtlas2LayoutData n2Layout = n2.getLayoutData(); // Get the distance double xDist = n1.x() - n2.x(); double yDist = n1.y() - n2.y(); double distance = Math.sqrt(xDist * xDist + yDist * yDist) - n1.size() - n2.size(); if (distance > 0) { // NB: factor = force / distance double factor = -coefficient * e * Math.log(1 + distance) / distance / n1Layout.mass; n1Layout.dx += xDist * factor; n1Layout.dy += yDist * factor; n2Layout.dx -= xDist * factor; n2Layout.dy -= yDist * factor; } } }
public static void fcBiAttractor_noCollide(Node N1, Node N2, double c) { double xDist = N1.x() - N2.x(); // distance en x entre les deux noeuds double yDist = N1.y() - N2.y(); double dist = (float) Math.sqrt(xDist * xDist + yDist * yDist) - N1.size() - N2.size(); // distance (from the border of each node) if (dist > 0) { double f = attraction(c, dist); ForceVectorNodeLayoutData N1L = N1.getLayoutData(); ForceVectorNodeLayoutData N2L = N2.getLayoutData(); N1L.dx += xDist / dist * f; N1L.dy += yDist / dist * f; N2L.dx -= xDist / dist * f; N2L.dy -= yDist / dist * f; } }
@Override public void apply(Node n1, Node n2, double e) { ForceAtlas2LayoutData n1Layout = n1.getLayoutData(); ForceAtlas2LayoutData n2Layout = n2.getLayoutData(); // Get the distance double xDist = n1.x() - n2.x(); double yDist = n1.y() - n2.y(); double distance = Math.sqrt(xDist * xDist + yDist * yDist) - n1.size() - n2.size(); if (distance > 0) { // NB: factor = force / distance double factor = -coefficient * e; n1Layout.dx += xDist * factor; n1Layout.dy += yDist * factor; n2Layout.dx -= xDist * factor; n2Layout.dy -= yDist * factor; } } }
public static void fcUniRepulsor(Node N1, Node N2, double c) { double xDist = N1.x() - N2.x(); // distance en x entre les deux noeuds double yDist = N1.y() - N2.y(); double dist = (float) Math.sqrt(xDist * xDist + yDist * yDist); // distance tout court if (dist > 0) { double f = repulsion(c, dist); ForceVectorNodeLayoutData N2L = N2.getLayoutData(); N2L.dx -= xDist / dist * f; N2L.dy -= yDist / dist * f; } }
public static void fcUniAttractor(Node N1, Node N2, float c) { double xDist = N1.x() - N2.x(); // distance en x entre les deux noeuds double yDist = N1.y() - N2.y(); double dist = (float) Math.sqrt(xDist * xDist + yDist * yDist); // distance tout court if (dist > 0) { double f = attraction(c, dist); ForceVectorNodeLayoutData N2L = N2.getLayoutData(); N2L.dx -= xDist / dist * f; N2L.dy -= yDist / dist * f; } }
@Override public void apply(Node n, Region r) { ForceAtlas2LayoutData nLayout = n.getLayoutData(); // Get the distance double xDist = n.x() - r.getMassCenterX(); double yDist = n.y() - r.getMassCenterY(); double distance = (float) Math.sqrt(xDist * xDist + yDist * yDist); if (distance > 0) { // NB: factor = force / distance double factor = coefficient * nLayout.mass * r.getMass() / distance / distance; nLayout.dx += xDist * factor; nLayout.dy += yDist * factor; } }
@Override public void apply(Node n, Region r) { ForceAtlas2LayoutData nLayout = n.getLayoutData(); // Get the distance double xDist = n.x() - r.getMassCenterX(); double yDist = n.y() - r.getMassCenterY(); double distance = (float) Math.sqrt(xDist * xDist + yDist * yDist); if (distance > 0) { // NB: factor = force / distance double factor = coefficient * nLayout.mass * r.getMass() / distance / distance; nLayout.dx += xDist * factor; nLayout.dy += yDist * factor; } else if (distance < 0) { double factor = -coefficient * nLayout.mass * r.getMass() / distance; nLayout.dx += xDist * factor; nLayout.dy += yDist * factor; } }