GY-63_MS5611/libraries/relativity/README.md

78 lines
3.4 KiB
Markdown
Raw Normal View History

2021-05-30 08:16:54 -04:00
[![Arduino CI](https://github.com/RobTillaart/relativity/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
2021-12-27 14:50:10 -05:00
[![Arduino-lint](https://github.com/RobTillaart/relativity/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/relativity/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/relativity/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/relativity/actions/workflows/jsoncheck.yml)
2021-05-30 08:16:54 -04:00
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/relativity/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/relativity.svg?maxAge=3600)](https://github.com/RobTillaart/relativity/releases)
# relativity
Arduino library with relativity functions.
## Description
2021-12-27 14:50:10 -05:00
This experimental library implements a number of functions that give an
indication of the time dilation etcetera due to relativistic speed.
2021-05-30 08:16:54 -04:00
2021-12-27 14:50:10 -05:00
Goal: Educational purposes or when one puts a cube-sat into space :)
2021-05-30 08:16:54 -04:00
## Interface
2021-12-27 14:50:10 -05:00
- **relativity()** constructor.
- **double getC()** returns speed of light.
- **double getG()** returns gravitational constant.
- **double factor(double speed)** returns sqrt(1-v2/c2).
- **double gamma(double speed)** returns 1/sqrt(1-v2/c2).
2021-05-30 08:16:54 -04:00
- **double relativeTime(double time, double speed)** returns the relative time for given time and speed.
- **double relativeLength(double length, double speed)** returns the relative length for given length and speed.
- **double relativeMass(double mass, double speed)** returns the relative mass for given mass and speed.
- **double EnergyMass(double mass, double speed)** returns the energyMass for given mass and speed. Think E = mc^2.
### Caching variants
2021-12-27 14:50:10 -05:00
These functions are the same however the math to calculate a given factor and gamma is done only once and cached.
So these functions will perform a bit better, especially if floating point is slow.
2021-05-30 08:16:54 -04:00
2021-12-27 14:50:10 -05:00
- **void setSpeed(double speed = 0)** set the speed and calculate the factor and gamma to minimize math for next functions.
2021-05-30 08:16:54 -04:00
- **double getSpeed()** returns speed set.
2021-12-27 14:50:10 -05:00
- **double getFactor()** returns factor for speed set.
2021-05-30 08:16:54 -04:00
- **double getGamma()** returns gamma for speed set.
- **double relativeTime(double time)** returns the relative time for speed set with **setSpeed()**.
- **double relativeLength(double length)** returns the relative length for speed set.
- **double relativeMass(double mass)** returns the relative mass for speed set.
- **double EnergyMass(double mass)** returns the energy mass for for speed set.
### Gravity effects
- **double gravitationalTime(double time, double speed)** returns time dilation due to gravitational effects.
2021-12-27 14:50:10 -05:00
- **double diameterEarth(double longitude = 45)** calculates the diameter of the Earth given it is not a nice
circle but more an ellipse, flatter on the poles and thicker on the equator.
Longitude is in degrees -90 .. 90.
2021-06-07 02:51:29 -04:00
- **double getPlanetMass(uint8_t n)** returns planet mass in **kg**
2021-12-27 14:50:10 -05:00
where parameter n: 0 = Sun, 1 = Mercury etc.
2021-06-07 02:51:29 -04:00
- **double getPlanetRadius(uint8_t n)** returns planet radius in **km**
2021-12-27 14:50:10 -05:00
where parameter n: 0 = Sun, 1 = Mercury etc.
2021-05-30 08:16:54 -04:00
## Operations
See examples for typical usage.
## Future
- test test test test
2022-08-04 06:11:24 -04:00
- Split .h into .h and .cpp
2021-05-30 08:16:54 -04:00
- add more functions
2022-08-04 06:11:24 -04:00
- Schwarzschild horizon etc
-
2021-05-30 08:16:54 -04:00
- fix some overflow conditions.
- add moons?
2022-08-04 06:11:24 -04:00
- need a database :)
2021-05-30 08:16:54 -04:00
- add caching version of mass / radius;