{"id":20989897,"url":"https://github.com/robtillaart/relativity","last_synced_at":"2026-02-25T18:04:43.827Z","repository":{"id":45254311,"uuid":"372051014","full_name":"RobTillaart/relativity","owner":"RobTillaart","description":"Arduino library with relativity functions","archived":false,"fork":false,"pushed_at":"2025-09-11T18:06:42.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-11T20:32:04.058Z","etag":null,"topics":["arduino","general","relativity"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobTillaart.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"RobTillaart","custom":"https://www.paypal.me/robtillaart"}},"created_at":"2021-05-29T19:04:30.000Z","updated_at":"2025-09-11T17:57:18.000Z","dependencies_parsed_at":"2024-04-13T10:29:48.853Z","dependency_job_id":"afb3d8b1-dab9-44e7-a1da-06c93229a4b8","html_url":"https://github.com/RobTillaart/relativity","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/RobTillaart/relativity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2Frelativity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2Frelativity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2Frelativity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2Frelativity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobTillaart","download_url":"https://codeload.github.com/RobTillaart/relativity/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2Frelativity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29833740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T17:57:15.019Z","status":"ssl_error","status_checked_at":"2026-02-25T17:56:11.472Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","general","relativity"],"created_at":"2024-11-19T06:26:37.327Z","updated_at":"2026-02-25T18:04:43.814Z","avatar_url":"https://github.com/RobTillaart.png","language":"C++","funding_links":["https://github.com/sponsors/RobTillaart","https://www.paypal.me/robtillaart"],"categories":[],"sub_categories":[],"readme":"\n[![Arduino CI](https://github.com/RobTillaart/relativity/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)\n[![Arduino-lint](https://github.com/RobTillaart/relativity/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/relativity/actions/workflows/arduino-lint.yml)\n[![JSON check](https://github.com/RobTillaart/relativity/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/relativity/actions/workflows/jsoncheck.yml)\n[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/relativity.svg)](https://github.com/RobTillaart/relativity/issues)\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/relativity/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/RobTillaart/relativity.svg?maxAge=3600)](https://github.com/RobTillaart/relativity/releases)\n[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/relativity.svg)](https://registry.platformio.org/libraries/robtillaart/relativity)\n\n\n# relativity\n\nArduino library with relativity functions.\n\n\n## Description\n\n**Experimental**\n\nThis experimental library implements a number of functions that give an\nindication of the time dilation etcetera due to relativistic speed.\n\nGoal: Educational purposes or when one puts a cube-sat into space :)\n\nFeedback is as always welcome.\n\n\n## Interface\n\n```cpp\n#include \"relativity.h\"\n```\n\n- **relativity()** constructor.\n- **double getC()** returns speed of light.\n- **double getG()** returns gravitational constant.\n- **double factor(double speed)** returns sqrt(1-v2/c2).\n- **double gamma(double speed)** returns 1/sqrt(1-v2/c2).\n- **double relativeTime(double time, double speed)** returns the relative time for given time and speed.\n- **double relativeLength(double length, double speed)** returns the relative length for given length and speed.\n- **double relativeMass(double mass, double speed)** returns the relative mass for given mass and speed.\n- **double EnergyMass(double mass, double speed)** returns the energyMass for given mass and speed. Think E = mc^2.\n\n\n### Caching variants\n\nThese functions are the same however the math to calculate a given factor and gamma is done only once and cached. \nSo these functions will perform a bit better, especially if floating point is slow.\n\n- **void setSpeed(double speed = 0)** set the speed and calculate the factor and gamma to minimize math for next functions.\n- **double getSpeed()** returns speed set.\n- **double getFactor()** returns factor for speed set.\n- **double getGamma()** returns gamma for speed set.\n- **double relativeTime(double time)** returns the relative time for speed set with **setSpeed()**.\n- **double relativeLength(double length)** returns the relative length for speed set.\n- **double relativeMass(double mass)** returns the relative mass for speed set.\n- **double EnergyMass(double mass)** returns the energy mass for for speed set.\n\n\n### Gravity effects\n\n- **double gravitationalTime(double time, double speed)** returns time dilation due to gravitational effects.\n- **double diameterEarth(double longitude = 45)** calculates the diameter of the Earth given it is not a nice \ncircle but more an ellipse, flatter on the poles and thicker on the equator.\nLongitude is in degrees -90 .. 90.\n- **double getPlanetMass(uint8_t n)** returns planet mass in **kg** \nwhere parameter n: 0 = Sun, 1 = Mercury etc.\n- **double getPlanetRadius(uint8_t n)** returns planet radius in **km** \nwhere parameter n: 0 = Sun, 1 = Mercury etc.\n\n\n## Operations\n\nSee examples for typical usage.\n\n\n## Future\n\n#### Must\n\n- documentation\n\n#### Should\n\n- test test test test\n\n#### Could\n\n- Split .h into .h and .cpp\n- add more functions\n  - Schwarzschild horizon etc\n- fix some overflow conditions.\n- add moons?\n  - need a database :)\n- add caching version of mass / radius;\n- move code to .cpp\n\n#### Wont\n\n\n## Support\n\nIf you appreciate my libraries, you can support the development and maintenance.\nImprove the quality of the libraries by providing issues and Pull Requests, or\ndonate through PayPal or GitHub sponsors.\n\nThank you,\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Frelativity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobtillaart%2Frelativity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Frelativity/lists"}