Hylograph.Forces.Collide
- Package
- purescript-hylograph-forces
- Repository
- afcondon/purescript-hylograph-forces
The collision force: treat each node as a circle and push overlapping circles apart.
Ported from d3-force 3.0.0, collide.js (ISC, Copyright 2010-2021 Mike
Bostock); see LICENSE.
The shape is the many-body force's. Each iteration builds a quadtree of
where the nodes are about to be (x + vx), turns it into a chain of
Regions that each know the largest radius inside them (d3's prepare),
and walks the chain once per node. A walk is pure: it returns the node's
new velocity and the new velocities of the nodes it pushed, and those
are written when the walk has returned. That is the same as d3 writing
them as it goes, because a walk meets each other node at most once and
never reads back a velocity it has changed.
Like d3, this looks only at the newest of several nodes at exactly the same place; the older ones are not collided with until something else moves them.
#defaultConfig Source
defaultConfig :: forall row. Config rowd3's defaults: radius 1, full strength, one iteration; and the two things d3 does not have turned off.
Those two are the Rust kernel's "yielding collision" (apply_collide
in force-kernel/src/forces.rs), held to it by test/differential.mjs:
alphaScaled: the strength used isstrength * alpha, so the collision weakens as the simulation cools and gives way to forces that hold a node at a place;include: a pair is tested only if both of its nodes are included. A node left out neither pushes nor is pushed. (It is still in the quadtree, where it can only widen the search.)
- Modules
- Hylograph.
Forces - Hylograph.
Forces. Center - Hylograph.
Forces. Cohesion - Hylograph.
Forces. Collide - Hylograph.
Forces. Contain - Hylograph.
Forces. Directional - Hylograph.
Forces. Group - Hylograph.
Forces. Link - Hylograph.
Forces. Linkage - Hylograph.
Forces. ManyBody - Hylograph.
Forces. Measure - Hylograph.
Forces. Node - Hylograph.
Forces. Position - Hylograph.
Forces. Quadtree - Hylograph.
Forces. Radial - Hylograph.
Forces. Random - Hylograph.
Forces. RectCollide - Hylograph.
Forces. Snapshot - Hylograph.
Forces. Tick - Hylograph.
Forces. Towards