Chemistry · class
RadiativeSources
The radiating things in a scene this tick: flames and hot surfaces both.
Explained in Chemistry.
class RadiativeSourcesimport { RadiativeSources } from '@driftengine/chemistry';In depth
Gathered into columns once per tick and read many times, which is why it is a structure rather than a callback. Cleared and refilled rather than reallocated.
Accessors
| Name | Type | Description |
|---|---|---|
countget | number |
Methods
clear
clear(): voidadd
add(x: number, y: number, z: number, temperature: number, area: number, power: number): void| Parameter | Type | Description |
|---|---|---|
x | number | |
y | number | |
z | number | |
temperature | number | |
area | number | |
power | number | W, which decides how far this source is worth testing against. |
temperatureOf
temperatureOf(source: number): number| Parameter | Type | Description |
|---|---|---|
source | number |
areaOf
areaOf(source: number): number| Parameter | Type | Description |
|---|---|---|
source | number |
reaches
reaches(source: number, x: number, y: number, z: number): booleanWhether a point is inside this source's own reach.
| Parameter | Type | Description |
|---|---|---|
source | number | |
x | number | |
y | number | |
z | number |
fluxAt
fluxAt(x: number, y: number, z: number, surfaceTemperature: number, emissivity: number, occluded: OcclusionTest | null): numberTotal flux onto a point from every source that can see it, W/m².
| Parameter | Type | Description |
|---|---|---|
x | number | |
y | number | |
z | number | |
surfaceTemperature | number | |
emissivity | number | |
occluded | OcclusionTest | null |
More
The receiver is treated as facing each source — a parcel is a lump rather than a plane, so there is no one normal to take a cosine against. What that costs is that a flat plate edge-on to a fire receives as much as one facing it; what it buys is not asking a consumer for a normal per parcel, which is a number most of them do not have.
hottestAt
hottestAt(x: number, y: number, z: number, occluded: OcclusionTest | null): numberThe temperature of the hottest source that reaches a point, or zero where none does.
| Parameter | Type | Description |
|---|---|---|
x | number | |
y | number | |
z | number | |
occluded | OcclusionTest | null |
More
What a radiative exchange is bounded by, and the reason it has to be bounded at all: the
radiative term is explicit, so a parcel whose surface shell has a small heat capacity — a coin,
a nail, a leaf — can absorb more in one step than would take it past the source that is heating
it, and then radiate the excess back as T⁴ and ring itself to pieces. It was found by putting
a copper coin on a hearth in demo/dev/chemistry.ts, where it reached 4,000 K on the first step
and 100 K a minute later.
Nothing can be heated past the thing heating it, so this is the equilibrium the step may reach and not exceed — which is what an implicit solve would give and costs one comparison per source.
reachesPoint
reachesPoint(x: number, y: number, z: number): booleanWhether any source reaches a point at all, which is the whole of the wake test.
| Parameter | Type | Description |
|---|---|---|
x | number | |
y | number | |
z | number |
More
§14's scan has to be coarse or sleeping saves nothing: this is a range comparison per source
and no view factor, no temperature and no occlusion ray. A source's range already comes from its
own power, so a bonfire wakes a parcel a candle would not.