Module

Hylograph.Forces.ThreeD

Package
purescript-hylograph-forces
Repository
afcondon/purescript-hylograph-forces

d3-force-3d's forces at three dimensions, in PureScript, beside the two-dimensional kernel of Hylograph.Forces and with the same shape: one Force type, applyForces, and tick (cool, apply, move).

Held to d3-force-3d 3.0.6 at numDimensions(3) bit for bit by test/differential-3d.mjs.

tick, applyForces and the order of a tick are ported from d3-force-3d 3.0.6, simulation.js (MIT, Copyright 2017 Vasco Asturiano; itself from d3-force, ISC, Mike Bostock); see LICENSE.

#Force Source

data Force :: Row Type -> Typedata Force row

An initialized force of any kind.

#manyBody Source

manyBody :: forall row. Config row -> Source -> Array (Node row) -> Force row

#linkById Source

linkById :: forall id row linkRow. Ord id => Show id => (Node row -> id) -> Config (Identified id linkRow) -> Source -> Array (Node row) -> Array (Identified id linkRow) -> Either String (Force row)

The link force for links that name their nodes by id; d3's error where a link names an id no node has.

#collide Source

collide :: forall row. Config row -> Source -> Array (Node row) -> Force row

#center Source

center :: forall row. Config -> Array (Node row) -> Force row

#positionX Source

positionX :: forall row. Config row -> Array (Node row) -> Force row

#positionY Source

positionY :: forall row. Config row -> Array (Node row) -> Force row

#positionZ Source

positionZ :: forall row. Config row -> Array (Node row) -> Force row

#radial Source

radial :: forall row. Config row -> Array (Node row) -> Force row

#applyForce Source

applyForce :: forall row. Number -> Force row -> Effect Unit

Apply one force at the given alpha: d3's force(alpha).

#applyForces Source

applyForces :: forall row. Number -> Array (Force row) -> Effect Unit

Apply forces in order, each seeing what the ones before it did.

#Settings Source

type Settings = { alphaDecay :: Number, alphaTarget :: Number, velocityRetention :: Number }

The settings of a tick that are not forces.

#defaultSettings Source

defaultSettings :: Settings

d3's defaults.

#tick Source

tick :: forall row. Settings -> Array (Force (Pinnable row)) -> Array (Node (Pinnable row)) -> Number -> Effect Number

One tick of d3-force-3d's simulation: cool alpha, apply the forces at the cooled alpha, move the nodes. Returns the cooled alpha, to pass to the next tick.