Documentation / @interstellar-tools/types / DisplayInterface
Interface: DisplayInterface
Defined in: celestial-bodies/display.ts:48
How a body is drawn: everything about rendering, kept apart from its physical data and its orbit.
It holds two 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.
The computed distances are in whatever unit the renderer uses for orbit.a (for example au), measured in the orbit's plane with the parent body at the origin and periapsis along +x.
Example
// Drawing an orbit: compute once, keep it on the body
const a = convertDistance(body.orbit.a, 'au').value;
const { e } = body.orbit;
body.display = {
...body.display,
semiMinorAxis: a * Math.sqrt(1 - e ** 2),
focusOffsetX: a * e
};Properties
color?
optional color?: string;Defined in: celestial-bodies/display.ts:50
Colour to draw the body in, as a hex string (#rrggbb) or a CSS colour name.
density?
optional density?: number;Defined in: celestial-bodies/display.ts:56
How densely to fill an area, e.g. how many asteroids to draw in a belt.
focusOffsetX?
optional focusOffsetX?: number;Defined in: celestial-bodies/display.ts:60
Distance from the ellipse's centre to its focus,
opacity?
optional opacity?: number;Defined in: celestial-bodies/display.ts:54
Transparency, from 0 (invisible) to 1 (solid).
orbitPath?
optional orbitPath?: CartesianCoordinatesInterface[];Defined in: celestial-bodies/display.ts:62
Points along the drawn orbit, computed by a renderer.
semiMinorAxis?
optional semiMinorAxis?: number;Defined in: celestial-bodies/display.ts:58
Semi-minor axis of the orbit,
size?
optional size?: number;Defined in: celestial-bodies/display.ts:52
Scaled size for drawing, not the physical size (see radius).