Struct bigbang::star::Star [] [src]

pub struct Star {
    // some fields omitted
}

Star structure

This structure represents all the parameters of the given star.

Methods

impl Star

fn new(last_id: u64, galaxy: u32) -> Star

Constructs a new Star.

It creates the star generating its parameters using statistical information from the known universe. It has two parameters: the first is the ID of the last star created and the second one is the ID of the current galaxy.

Examples

use star::Star;

let st = Star::new(0, 1);

fn get_id(&self) -> u64

Get ID

Gets the ID of the star.

fn get_galaxy_id(&self) -> u32

Get galaxy ID

Gets the ID of the galaxy of the star.

fn get_orbit(&self) -> u32

Get orbit

Gets the orbit radius around the center of the galaxy, in light years (ly).

fn get_class(&self) -> &StarClass

Get class

Gets the class of the star.

fn get_mass(&self) -> f64

Get mass

Gets the mass of the star, in kg.

fn get_radius(&self) -> f64

Get radius

Gets the radius of the star, in meters (m).

fn get_density(&self) -> f64

Get density

Gets the density of the star, in kg/m³.

fn get_volume(&self) -> f64

Get volume

Gets the volume of the star, in .

fn get_temperature(&self) -> u32

Get temperature

Gets the effective surface temperature of the star, in Kelvin (K).

fn get_luminosity(&self) -> f64

Get luminosity

Gets the luminosity of the star, in watts (W).

fn generate_num_bodies(&self) -> u8

Generate number of bodies

Generates a random number based on the star class and luminosity, that will be the number of bodies in the solar system.

fn generate_titius_bode(&self, bodies: u8) -> (f64, f64)

Generate Titius-Bode

Generates Titius-Bode law m and n parameters. It supposes that bodies > 0, or it will panic.