Star
Each Star
object represents a star on a star map. It records some basic information
(an identifier, a location, and a magnitude); in addition, some but not all stars have
been assigned a name. (In reality, many stars have multiple alternative names, but this
class does not capture that fact.)
- Value parameters:
- coords
the location of the star on a two-dimensional star map
- id
a number that uniquely identifies the star from the other visible stars (a so-called Henry Draper number)
- magnitude
the apparent magnitude (brightness) of the star: smaller means brighter!
- name
the star’s name (wrapped in
Some
), orNone
Value members
Concrete methods
Determines the location of this star within a given image of a star map.
This method effectively converts the coords
of this star (a StarCoords
) into
a Pos
within the given image. For instance, if this star has coords
of (0,0),
and a 400-by-400 pixel image is given, this method returns a Pos
of (200,200).
Determines the location of this star within a given image of a star map.
This method effectively converts the coords
of this star (a StarCoords
) into
a Pos
within the given image. For instance, if this star has coords
of (0,0),
and a 400-by-400 pixel image is given, this method returns a Pos
of (200,200).
- See also:
Returns a string description of the star. The format of the string varies slightly depending on whether the star has a name or not. For a named star, the description has the form "#ID NAME (COORDS)"; e.g., "#39801 Betelgeuse (x=0.02, y=0.99)". In case of an unnamed star, the name and one of the spaces are omitted; e.g.,"#39810 (x=0.016, y=0.30)".
Returns a string description of the star. The format of the string varies slightly depending on whether the star has a name or not. For a named star, the description has the form "#ID NAME (COORDS)"; e.g., "#39801 Betelgeuse (x=0.02, y=0.99)". In case of an unnamed star, the name and one of the spaces are omitted; e.g.,"#39810 (x=0.016, y=0.30)".
- Definition Classes