Documentation / @interstellar-tools/types / DisplayInterface
Interface: DisplayInterface
Defined in: celestial-bodies/display.ts:80
How a body is drawn: everything about rendering, kept apart from its physical data, its orbit and its observations.
It holds three kinds of values:
- Hints from the datasets:
coloron every body,sizeon comets and asteroids,opacityanddensityon asteroid belts. - State a renderer computes and keeps on the body, so it doesn't have to recompute it every frame:
semiMinorAxis,focusOffsetXandorbitPath. The datasets never set these. - How to draw the body itself, for a procedural renderer:
model, and the groups that model reads,surface,bands,clouds,atmosphere,emission,rings,photosphere,astrosphere,coma,galaxyandblackHole, with a noiseseed. They come from the body'sobservationsor from images of it, andderivationrecords which.
INFO
- Colours are hex strings (
#rrggbb) or CSS colour names, likecolor. - Intensities, coverages and fractions run from 0 to 1.
- Sizes in the drawing groups are in multiples of the drawn body's radius, never physical units, but for
astrosphere's, which come fromobservations. The physical sizes, such as a ring's radii, are inobservations. - The computed orbit distances are in whatever unit the renderer uses for
orbit.a(for example au), in the orbit's plane, with the parent at the origin and periapsis along +x.
Examples
// Drawing an orbit: compute once, keep it on the body
const a = convertDistanceUnit(body.orbit.a, 'au').value;
const { e } = body.orbit;
body.display = {
...body.display,
semiMinorAxis: a * Math.sqrt(1 - e ** 2),
focusOffsetX: a * e
};// Saturn, for a procedural renderer
const saturn: DisplayInterface = {
color: '#D2B48C',
model: 'giant',
bands: {
palette: ['#d4b884', '#efe1bd', '#b8975f'],
count: 12,
contrast: 0.45
},
rings: { color: '#d6c4a0', opacity: 0.95, shadows: true }
};Properties
astrosphere?
astrosphere?: DisplayAstrosphereInterface;Defined in: celestial-bodies/display.ts:112
How to draw a star's astrosphere.
atmosphere?
atmosphere?: DisplayAtmosphereInterface;Defined in: celestial-bodies/display.ts:104
The glow of an atmosphere at the limb.
bands?
bands?: DisplayBandsInterface;Defined in: celestial-bodies/display.ts:100
A giant planet's belts, zones and storms.
blackHole?
blackHole?: DisplayBlackHoleInterface;Defined in: celestial-bodies/display.ts:118
A black hole's photon ring and accretion disk.
clouds?
clouds?: DisplayCloudsInterface;Defined in: celestial-bodies/display.ts:102
A cloud layer over a solid surface.
color?
color?: string;Defined in: celestial-bodies/display.ts:82
Colour to draw the body in, as a hex string (#rrggbb) or a CSS colour name.
coma?
coma?: DisplayComaInterface;Defined in: celestial-bodies/display.ts:114
A comet's coma and tails.
density?
density?: number;Defined in: celestial-bodies/display.ts:88
How densely to fill an area, e.g. how many asteroids to draw in a belt.
derivation?
derivation?: DisplayDerivationInterface[];Defined in: celestial-bodies/display.ts:122
Why each drawing value is what it is.
emission?
emission?: DisplayEmissionInterface;Defined in: celestial-bodies/display.ts:106
Light the body gives off itself, seen on its night side too.
focusOffsetX?
focusOffsetX?: number;Defined in: celestial-bodies/display.ts:92
Distance from the ellipse's centre to its focus,
galaxy?
galaxy?: DisplayGalaxyInterface;Defined in: celestial-bodies/display.ts:116
A galaxy's bulge, disk and arms.
model?
model?: DisplayModelType;Defined in: celestial-bodies/display.ts:96
Which procedural model draws the body.
opacity?
opacity?: number;Defined in: celestial-bodies/display.ts:86
Transparency, from 0 (invisible) to 1 (solid).
orbitPath?
orbitPath?: CartesianCoordinatesInterface[];Defined in: celestial-bodies/display.ts:94
Points along the drawn orbit, computed by a renderer.
photosphere?
photosphere?: DisplayPhotosphereInterface;Defined in: celestial-bodies/display.ts:110
A star's disc: its colour, limb darkening, granulation, spots and corona.
rings?
rings?: DisplayRingsInterface;Defined in: celestial-bodies/display.ts:108
How to draw the rings in observations.rings.
seed?
seed?: number;Defined in: celestial-bodies/display.ts:120
A seed for the procedural noise, so the body always looks the same.
semiMinorAxis?
semiMinorAxis?: number;Defined in: celestial-bodies/display.ts:90
Semi-minor axis of the orbit,
size?
size?: number;Defined in: celestial-bodies/display.ts:84
Scaled size for drawing, not the physical size (see radius).
surface?
surface?: DisplaySurfaceInterface;Defined in: celestial-bodies/display.ts:98
A solid surface: its colours, relief, oceans, ice caps and lava.