Struct bigbang::planet::Planet
[−]
[src]
pub struct Planet<'p> { // some fields omitted }
Planet structure
This structure defines a planet and contains all the structures needed for a correct definition and representation of itself.
Methods
impl<'p> Planet<'p>
Crust structure
This structure represents the crust composition of the planet, time in kg per element. It will only contain the composition of the crust of the planet, that will allow for the players to dig and take resources. Life structure
This structure represents the life in the planet.
fn new(st: &'p Star, m: f64, n: f64, position: u8, last_sm_a: f64) -> Planet
Constructs a new Planet
.
It creates a random planet taking into account real planet statistics. It requires the reference to parent star and the two values of the Titius–Bode law, along with the order of the planet in the solar system and the last body's semi-major axis in the solar system.
Examples
use star::Star; use planet::Planet; let st = Star::new(0, 1); let num_bodies = star.calculate_num_bodies(); let (tb_m, tb_n) = star.calculate_titius_bode(num_bodies); if num_bodies > 0 { let planet = Planet::new(&star, tb_m, tb_n, 1); }
fn get_orbit(&self) -> &Orbit
Get Orbit
Gets the orbit information of the planet.
fn get_atmosphere(&self) -> Option<&Atmosphere>
Get Atmosphere
Gets the atmosphere information of the planet.
fn get_surface(&self) -> Option<&Surface>
Get Surface
Gets the surface information of the planet.
fn get_type(&self) -> &PlanetType
Get planet type
Gets the type of the planet.
fn get_bond_albedo(&self) -> f64
Get Bond albedo
Gets the Bond albedo of the planet. The Bond albedo is the reflectivity of the planet, or in other words, the percentage of light reflected by the planet, from 0 to 1.
fn get_geometric_albedo(&self) -> f64
Get geometric albedo
Gets the geometric albedo of the planet. The geometric albedo is the reflectivity of the planet, but only taking into account the light that reflects directly back to the emission, or in other words, how bright an observer would see the planet if looking at it directly from the light source, from 0 to 1.
fn get_mass(&self) -> f64
Get mass
Gets the mass of the planet in kg.
fn get_radius(&self) -> f64
Get radius
Gets the radius of the planet, in meters (m).
fn get_density(&self) -> f64
Get density
Gets the density of the planet, in kg/m³.
fn get_volume(&self) -> f64
Get volume
Gets the volume of the planet, in m³.
fn get_greenhouse(&self) -> f64
Get greenhouse effect
Gets the greenhouse effect of the planet, as a multiplier.
fn get_eff_temp(&self) -> f64
Get effective temperature
Gets the effective temperature of the planet, in Kelvin (K).
fn get_min_temp(&self) -> f64
Get minimum temperature
Gets the minimum temperature of the planet, in Kelvin (K).
fn get_avg_temp(&self) -> f64
Get average temperature
Gets the average temperature of the planet, in Kelvin (K).
fn get_max_temp(&self) -> f64
Get maximum temperature
Gets the maximum temperature of the planet, in Kelvin (K).
fn get_surface_gravity(&self) -> f64
Get surface gravity
Gets the surface gravity of the planet, in m/s².
fn is_earth_twin(&self) -> bool
Check if is earth twin
Checks if the properties of the planet are similar to the ones in Earth
fn is_habitable(&self) -> bool
fn is_roche_ok(&self) -> bool
Check Roche limit
Checks if the Roche limit for the planet is correct.