Module

Hylograph.Forces.ThreeD.Node

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

The simulation node in three dimensions: a JavaScript object typed as a record, which the forces update in place, as Hylograph.Forces.Node is in two.

The foreign code is the same four assignments as in two dimensions, with a third coordinate (Node.js). The same rule holds: a mutable field is read where its value is used, in the arguments of the write that replaces it or inside a pure function that returns before anything is written.

#Node Source

type Node :: Row Type -> Typetype Node row = { vx :: Number, vy :: Number, vz :: Number, x :: Number, y :: Number, z :: Number | row }

A node of the simulation: position and velocity in three dimensions, and whatever else the application keeps on it.

#Pinnable Source

type Pinnable :: Row Type -> Row Typetype Pinnable row = (fx :: Nullable Number, fy :: Nullable Number, fz :: Nullable Number | row)

The fields that pin a node: where fx, fy or fz is present the integration step puts the node there on that axis and stops it. Absent, null and undefined all mean unpinned, as in d3-force-3d.

#writeVelocity Source

writeVelocity :: forall row. EffectFn4 (Node row) Number Number Number Unit

node.vx = vx; node.vy = vy; node.vz = vz

#writePosition Source

writePosition :: forall row. EffectFn4 (Node row) Number Number Number Unit

node.x = x; node.y = y; node.z = z

#writePin Source

writePin :: forall row. EffectFn4 (Node (Pinnable row)) (Nullable Number) (Nullable Number) (Nullable Number) Unit

node.fx = fx; node.fy = fy; node.fz = fz

#writeIndex Source

writeIndex :: forall row. EffectFn2 (Node row) Int Unit

node.index = index, for d3-force-3d's initializeNodes. As in two dimensions, the row is not asked to contain index.