Stars Docs
Fall 2026
API

# Star

o1.stars.Star
class Star(val `id`: Int, val `coords`: StarCoords, val `magnitude`: Double, val `name`: Option[String])

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.)

## 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.k.a. the star’s Henry Draper number)

magnitude

  the apparent magnitude (brightness) of the star: smaller means brighter!

name

  the star’s name (wrapped in `Some`), or `None`

## Attributes

Graph
Supertypes
  class Object
  trait Matchable
  class Any

## Members list

### Value members

#### Concrete methods

def posIn(`skyPic`: Pic): Pos

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).

## Attributes

See also

  StarCoords.toImagePos

override def toString: String

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)". If the star is unnamed, 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)". If the star is unnamed, the name and one of the spaces are omitted; e.g., "#39810 (x=0.016, y=0.30)".

## Attributes

Definition Classes
  Any

#### Concrete fields

val coords: StarCoords
val id: Int
val magnitude: Double
val name: Option[String]