Module

Hylograph.Config.Scene

Package
purescript-hylograph-simulation
Repository
afcondon/purescript-hylograph-simulation

Simulation Setup Configuration Module

A SimulationSetup represents a complete D3 simulation configuration:

  • Which forces are active
  • Simulation parameters (alpha, decay rates, etc.)

Setups are composable and can be merged, filtered, or transformed.

#Label Source

type Label = String

#SimulationParams Source

type SimulationParams = { alpha :: Number, alphaDecay :: Number, alphaMin :: Number, alphaTarget :: Number, velocityDecay :: Number }

Simulation-level parameters These control the physics engine behavior

#defaultSimParams Source

defaultSimParams :: SimulationParams

Default simulation parameters (matches d3-force defaults)

#fastSimParams Source

fastSimParams :: SimulationParams

Fast convergence parameters (for quick transitions)

#slowSimParams Source

slowSimParams :: SimulationParams

Slow convergence parameters (for smooth, gradual layouts)

#SimulationSetup Source

newtype SimulationSetup

Complete scene configuration

Constructors

Instances

#setup Source

setup :: String -> Array ForceConfig -> SimulationSetup

Create a setup with default simulation parameters

#setupWithParams Source

setupWithParams :: String -> Array ForceConfig -> SimulationParams -> SimulationSetup

Create a setup with custom simulation parameters

#withDescription Source

withDescription :: String -> SimulationSetup -> SimulationSetup

Add description to a setup

#withSimParams Source

withSimParams :: SimulationParams -> SimulationSetup -> SimulationSetup

Update simulation parameters

#withAlpha Source

withAlpha :: Number -> SimulationSetup -> SimulationSetup

Set alpha (energy level) for a setup

#withAlphaTarget Source

withAlphaTarget :: Number -> SimulationSetup -> SimulationSetup

Set alpha target (simulation runs until alpha ≤ target)

#addForce Source

addForce :: ForceConfig -> SimulationSetup -> SimulationSetup

Add a force to a setup

#removeForce Source

removeForce :: Label -> SimulationSetup -> SimulationSetup

Remove a force from a setup by name

#keepForces Source

keepForces :: Array Label -> SimulationSetup -> SimulationSetup

Keep only specified forces

#excludeForces Source

excludeForces :: Array Label -> SimulationSetup -> SimulationSetup

Remove specified forces

#replaceForce Source

replaceForce :: ForceConfig -> SimulationSetup -> SimulationSetup

Replace a force in a setup (by name)

#updateForce Source

updateForce :: Label -> (ForceConfig -> ForceConfig) -> SimulationSetup -> SimulationSetup

Update a force in a setup using a transformation function

#mergeSetups Source

mergeSetups :: SimulationSetup -> SimulationSetup -> SimulationSetup

Merge two setups Forces from the second setup override those with the same name from the first Simulation params from the second setup are used

#getForce Source

getForce :: Label -> SimulationSetup -> Maybe ForceConfig

Get a force from a setup by name

#hasForce Source

hasForce :: Label -> SimulationSetup -> Boolean

Check if a setup has a force with the given name

#forceNames Source

forceNames :: SimulationSetup -> Array Label

Get all force names in a setup

#forceCount Source

forceCount :: SimulationSetup -> Int

Count forces in a setup