Skip to the content

Hoshi Stars星

The stars you can see without a telescope, with names, colours and distances; the 88 constellations with their lines and boundaries; the Messier objects; and seven map projections to draw them on.

Hoshi is the Japanese word 星 for a star. About the name

Contents

Reference · Names on the brightest stars and the constellation figures as faint lines, for a sky you draw yourself: a count or a magnitude, the figure under the pointer at full strength, a body that covers part of the sky, and a look set by settings alone

placeLabelfunction

Put a name on one side of a star: right, left, above (centred over it) or below (centred under it), with the star's catalogue letter under the name when designation is true. Writes into out and answers whether the whole block, and its line, are inside the view. createStarNames tries the four sides in order and takes the first that covers no other name and no star.

Import it

import { placeLabel } from "@johnmorrisdotca/hoshi-stars/sky-labels";

Definition

function placeLabel(x: number, y: number, width: number, style: LabelStyle, view: SkyView, out: StarNameLabel, designation?: boolean, side?: LabelSide): boolean

Parameters

NameTypeDescription
xnumber

The star's x on the screen.

ynumber

The star's y on the screen.

widthnumber

The widest line's width in pixels (labelWidth, and designationWidth for the line under it).

styleLabelStyle

A complete look.

viewSkyView

The part of the screen names may use.

outStarNameLabel

Where the answer is written.

designation (optional)boolean

True when a line for the catalogue letter goes under the name.

side (optional)"below" | "right" | "left" | "above"

Which side; right by default. A leader line (the look's leader) goes with right and left only.

Returns

boolean

true when it fits.

Examples

import { labelStyle, labelWidth, placeLabel, type StarNameLabel } from "@johnmorrisdotca/hoshi-stars/sky-labels";

const style = labelStyle({ leader: 14 });
const out = {} as StarNameLabel;
console.log(placeLabel(395, 100, labelWidth("Rigel", style), style, { width: 400, height: 300 }, out), placeLabel(395, 100, labelWidth("Rigel", style), style, { width: 400, height: 300 }, out, false, "left"), out.anchor);
false true end

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hoshi-stars 0.47.0.