SkyPic

object SkyPic

This singleton object provides utilities for creating and manipulating images that represent views of a night sky.

class Object
trait Matchable
class Any
SkyPic.type

Value members

Concrete methods

def create(skyData: StarMap, bgSize: Int): Pic

Given a StarMap that details what is visible in the sky, produces a Pic that represents that information as an image. The background of the image is a Black square of the given size. Each star and constellation in the sky appear against that background.

Given a StarMap that details what is visible in the sky, produces a Pic that represents that information as an image. The background of the image is a Black square of the given size. Each star and constellation in the sky appear against that background.

Value parameters:
bgSize

the width and height, in pixels, of the desired square image

skyData

the contents of the night sky that are to be represented as an image

def placeConstellation(skyPic: Pic, constellation: Constellation): Pic

Given an image of the sky and a star, returns a version of the original image with a constellation drawn on top.

Given an image of the sky and a star, returns a version of the original image with a constellation drawn on top.

A constellation is depicted using a combination of red circles and yellow lines. At each star that belongs to the constellation, a red circle with a diameter of 4 pixels is added. A yellow line is then drawn between each pair of connected stars. The positions of the stars within the image are determined as in placeStar.

def placeStar(skyPic: Pic, star: Star): Pic

Given an image of the sky and a star, returns a version of the original image with an image of the star placed on top. That is, forms an image of the star and places it against the given (larger) image in a Pos that corresponds to the star’s StarCoords.

Given an image of the sky and a star, returns a version of the original image with an image of the star placed on top. That is, forms an image of the star and places it against the given (larger) image in a Pos that corresponds to the star’s StarCoords.

The star is depicted as a White circle whose diameter is 12.0 / (M + 2), where M is the star’s magnitude. Its position within the resulting image is determined by the star’s posIn method. The given star must have a magnitude greater than -2.

For example, say the background image is 400 by 400 pixels, and the given star has the coords (0.5,0.0) and a magnitude of -0.5. The returned image will then consist of the given background image with white circle of radius 4 placed upon it at (300,200).

Value parameters:
skyPic

an image to place the star upon

star

a star (of magnitude > -2) that should be depicted against the given image