Module
Hylograph.Forces.ThreeD.Radial
- Package
- purescript-hylograph-forces
- Repository
- afcondon/purescript-hylograph-forces
The radial force in three dimensions: pull each node towards a sphere.
Ported from d3-force-3d 3.0.6, radial.js (MIT, Copyright 2017 Vasco
Asturiano; itself from d3-force, ISC, Mike Bostock); see LICENSE.
Besides the third coordinate, d3-force-3d reads y and z as zero where
they are NaN ((node.y || 0) - y); x is read as it is, as in d3-force.
#defaultConfig Source
defaultConfig :: forall row. Config rowd3's defaults for everything but the radius, which d3 requires: here a sphere of radius 100 about the origin, at strength 0.1.
#initialize Source
initialize :: forall row. Config row -> Array (Node row) -> Radial rowforce.initialize(nodes). A node whose radius is NaN gets strength
zero.
#apply Source
apply :: forall row. Radial row -> Number -> Effect Unitd3-force-3d's force(alpha):
dx = node.x - x || 1e-6,
dy = (node.y || 0) - y || 1e-6,
dz = (node.z || 0) - z || 1e-6,
r = Math.sqrt(dx * dx + dy * dy + dz * dz),
k = (radiuses[i] - r) * strengths[i] * alpha / r;
node.vx += dx * k; node.vy += dy * k; node.vz += dz * k;
- 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. ThreeD - Hylograph.
Forces. ThreeD. Center - Hylograph.
Forces. ThreeD. Collide - Hylograph.
Forces. ThreeD. Link - Hylograph.
Forces. ThreeD. ManyBody - Hylograph.
Forces. ThreeD. Node - Hylograph.
Forces. ThreeD. Octree - Hylograph.
Forces. ThreeD. Position - Hylograph.
Forces. ThreeD. Radial - Hylograph.
Forces. ThreeD. Tick - Hylograph.
Forces. Tick - Hylograph.
Forces. Towards