Expand description
The sun
crate is a library for calculating the position of the sun.
It is a port of the JavaScript
library
suncalc.
§Example
let unixtime = suncalc::Timestamp(1362441600000);
let lat = 48.0;
let lon = 9.0;
let moon_pos = suncalc::get_position(unixtime,lat,lon);
let az = moon_pos.azimuth.to_degrees();
let alt = moon_pos.altitude.to_degrees();
println!("The position of the sun is {}/{}", az, alt);
Structs§
- Illumination
- Holds illuminated fraction of the moon, the phase, and the angle.
- Position
- Holds the azimuth and altitude angles of the sun position.
- SunTimes
- Timestamp
- UNIX timestamp in milliseconds
Functions§
- get_
position - Calculates the sun position for a given date and latitude/longitude. The angles are calculated as radians.
- get_
times - moon_
illumination - Calculates the moon illumination, phase, and angle for a given date
- moon_
pos - Calculates the moon position for a given date and latitude/longitude