Chemistry · class

ChemistryWorld

Explained in Chemistry.

class ChemistryWorld
import { ChemistryWorld } from '@driftengine/chemistry';

Constructor

new

constructor( /** The parcels this world steps. Readable, because `fingerprintChemistry` hashes them. */ parcels: ParcelStore, /** The air, or `null` for a world with none. Readable for the same reason. */ field?: AtmosphereField | null, options?: ChemistryWorldOptions)
ParameterTypeDescription
/** The parcels this world steps. Readable
because `fingerprintChemistry` hashes them. */ parcels: ParcelStore
/** The air
or `null` for a world with none. Readable for the same reason. */ field?: AtmosphereField | null
options?ChemistryWorldOptions

Properties

NameTypeDescription
parcelsreadonlyParcelStoreThe parcels this world steps. Readable, because fingerprintChemistry hashes them.
fieldreadonlyAtmosphereField | nullThe air, or null for a world with none. Readable for the same reason.
sourcesreadonlyRadiativeSourcesRefilled by the caller each tick: what is radiating.
contactsreadonlyContactSetRefilled by the caller each tick: what is touching what.
eventsreadonlyChemistryEventsDrained by the caller each tick: what happened. Cleared at the top of every simulate.
occludedOcclusionTest | nullWhether anything solid stands between two points.
More

Absent, every source is visible — the cheap default, and wrong indoors. A consumer supplies a raycast; §10 budgets and caches it, which is CH-6's work rather than this phase's.

Methods

simulate

simulate(dt: number, windX?: number, windZ?: number): void

One fixed step, in the order §13 gives.

ParameterTypeDescription
dtnumber
windX?number
windZ?number
More

Sleeping and the tier cadence are both here rather than inside the terms they skip, because both are decisions about whether a parcel is stepped at all and a term that decided for itself would be four places deciding the same thing four ways.

ignitionProgressOf

ignitionProgressOf(parcel: number): number

How close a parcel is to catching, 0 to 1. A readout; nothing branches on it.

ParameterTypeDescription
parcelnumber

elementTotals

elementTotals(out: Float64Array): void

Moles of each element in the parcels and the air together. Writes into out.

ParameterTypeDescription
outFloat64Array