From f429ab1582d397a5c6bad45a6c5e4bde91882a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Mon, 27 Jul 2020 12:18:27 +0200 Subject: [PATCH 1/5] prepare deps for d3v6 --- package.json | 6 +++--- yarn.lock | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 08369af..062929b 100644 --- a/package.json +++ b/package.json @@ -37,9 +37,9 @@ "dist/**/*.js" ], "dependencies": { - "d3-dispatch": "1", - "d3-quadtree": "1", - "d3-timer": "1" + "d3-dispatch": ">=2.0.0-rc.1", + "d3-quadtree": ">=2.0.0-rc.1", + "d3-timer": ">=2.0.0-rc.1" }, "sideEffects": false, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 65f272d..26a8eeb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -169,20 +169,20 @@ cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -d3-dispatch@1: - version "1.0.5" - resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-1.0.5.tgz#e25c10a186517cd6c82dd19ea018f07e01e39015" - integrity sha512-vwKx+lAqB1UuCeklr6Jh1bvC4SZgbSqbkGBLClItFBIYH4vqDJCA7qfoy14lXmJdnBOdxndAMxjCbImJYW7e6g== - -d3-quadtree@1: - version "1.0.6" - resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-1.0.6.tgz#d1ab2a95a7f27bbde88582c94166f6ae35f32056" - integrity sha512-NUgeo9G+ENQCQ1LsRr2qJg3MQ4DJvxcDNCiohdJGHt5gRhBW6orIB5m5FJ9kK3HNL8g9F4ERVoBzcEwQBfXWVA== - -d3-timer@1: - version "1.0.9" - resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-1.0.9.tgz#f7bb8c0d597d792ff7131e1c24a36dd471a471ba" - integrity sha512-rT34J5HnQUHhcLvhSB9GjCkN0Ddd5Y8nCwDBG2u6wQEeYxT/Lf51fTFFkldeib/sE/J0clIe0pnCfs6g/lRbyg== +d3-dispatch@>=2.0.0-rc.1: + version "2.0.0-rc.1" + resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-2.0.0-rc.1.tgz#cb7a29779b4dd4241ccef5b8a19f46a5e727f47b" + integrity sha512-JRzTbYPZ1GDu+eGZPOVyyhveu49PEL3msPVXBFEUDk0xCqhX7Eu2tCVcl+1gculBCkj6LEW2f725QmxWVsOPaA== + +d3-quadtree@>=2.0.0-rc.1: + version "2.0.0-rc.1" + resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-2.0.0-rc.1.tgz#afc76b7ca3f63c3e0cb88fc246b30276beab0623" + integrity sha512-rt2PaorxXzxZYHw1nSM82nJjIj91VU3/r40LPNBGqIhRXlTuAlgspOH8/w85OOCqxSsV0c1qKwbzYIu/8bwD7A== + +d3-timer@>=2.0.0-rc.1: + version "2.0.0-rc.1" + resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-2.0.0-rc.1.tgz#8afc777810198f28d9b2ac1ef8765b767ce4bc22" + integrity sha512-Kfi4LnjFC1t1MnnjCrHh3TyQIJr9/mMjmjeTFYwG364CtTKtv8snI/juT5zoiCCsMwrxdzwrM7Kmpj24p/AClw== debug@^4.0.1: version "4.1.1" From f3bb4780797368c79e79b9cc2fb77b2cfadc3fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Thu, 25 Jun 2020 17:14:07 +0200 Subject: [PATCH 2/5] deterministic prng fixes #121 thanks, @benstevens48! --- src/jiggle.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/jiggle.js b/src/jiggle.js index de46cff..04231fe 100644 --- a/src/jiggle.js +++ b/src/jiggle.js @@ -1,3 +1,9 @@ -export default function() { - return (Math.random() - 0.5) * 1e-6; +// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use +const a = 1664525, + c = 1013904223, + m = 4294967296; +let s = 1; +export default function(seed) { + if (seed) s = Math.abs(a * seed); + return ((s = (a * s + c) % m) / m - 0.5) * 1e-6; } From 8f588179737ac62f68042a1ae89ddee3c0bba1ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Tue, 28 Jul 2020 11:14:57 +0200 Subject: [PATCH 3/5] v2.1.0-rc.2 --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 062929b..8f8a8e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,9 @@ { "name": "d3-force", - "version": "2.0.1", + "version": "2.1.0-rc.2", + "publishConfig": { + "tag": "next" + }, "description": "Force-directed graph layout using velocity Verlet integration.", "keywords": [ "d3", From 8ac135ee5adeebc6e4861e755805d0eb812e6101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Tue, 28 Jul 2020 11:24:45 +0200 Subject: [PATCH 4/5] links --- README.md | 108 +++++++++++++++++++++++++++--------------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index bf24aef..667e5b5 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@ This module implements a [velocity Verlet](https://en.wikipedia.org/wiki/Verlet_integration) numerical integrator for simulating physical forces on particles. The simulation is simplified: it assumes a constant unit time step Δ*t* = 1 for each step, and a constant unit mass *m* = 1 for all particles. As a result, a force *F* acting on a particle is equivalent to a constant acceleration *a* over the time interval Δ*t*, and can be simulated simply by adding to the particle’s velocity, which is then added to the particle’s position. -In the domain of information visualization, physical simulations are useful for studying [networks](http://bl.ocks.org/mbostock/ad70335eeef6d167bc36fd3c04378048) and [hierarchies](http://bl.ocks.org/mbostock/95aa92e2f4e8345aaa55a4a94d41ce37)! +In the domain of information visualization, physical simulations are useful for studying [networks](https://bl.ocks.org/mbostock/ad70335eeef6d167bc36fd3c04378048) and [hierarchies](https://observablehq.com/@d3/force-directed-tree)! -[Force Dragging III](http://bl.ocks.org/mbostock/ad70335eeef6d167bc36fd3c04378048)[Force-Directed Tree](http://bl.ocks.org/mbostock/95aa92e2f4e8345aaa55a4a94d41ce37) +[Force Dragging III](https://bl.ocks.org/mbostock/ad70335eeef6d167bc36fd3c04378048)[Force-Directed Tree](https://observablehq.com/@d3/force-directed-tree) -You can also simulate circles (disks) with collision, such as for [bubble charts](http://www.nytimes.com/interactive/2012/09/06/us/politics/convention-word-counts.html) or [beeswarm plots](http://bl.ocks.org/mbostock/6526445e2b44303eebf21da3b6627320): +You can also simulate circles (disks) with collision, such as for [bubble charts](http://www.nytimes.com/interactive/2012/09/06/us/politics/convention-word-counts.html) or [beeswarm plots](https://observablehq.com/@d3/beeswarm): -[Collision Detection](http://bl.ocks.org/mbostock/31ce330646fa8bcb7289ff3b97aab3f5)[Beeswarm](http://bl.ocks.org/mbostock/6526445e2b44303eebf21da3b6627320) +[Collision Detection](https://bl.ocks.org/mbostock/31ce330646fa8bcb7289ff3b97aab3f5)[Beeswarm](https://observablehq.com/@d3/beeswarm) You can even use it as a rudimentary physics engine, say to simulate cloth: -[Force-Directed Lattice](http://bl.ocks.org/mbostock/1b64ec067fcfc51e7471d944f51f1611) +[Force-Directed Lattice](https://bl.ocks.org/mbostock/1b64ec067fcfc51e7471d944f51f1611) To use this module, create a [simulation](#simulation) for an array of [nodes](#simulation_nodes), and compose the desired [forces](#simulation_force). Then [listen](#simulation_on) for tick events to render the nodes as they update in your preferred graphics system, such as Canvas or SVG. @@ -21,9 +21,9 @@ To use this module, create a [simulation](#simulation) for an array of [nodes](# If you use NPM, `npm install d3-force`. Otherwise, download the [latest release](https://github.com/d3/d3-force/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-force.v2.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3_force` global is exported: ```html - - - + + +