Comments (1)
Headache outline:
The nice thing so far has been that predict_sun() and predict_moon() uses no special sun or moon structs, but the same struct predict_observation as the rest of the library. This makes some things more smooth for e.g. flyby. However, we apparently need new fields which don't exist within struct predict_observation.
We've also had only one function (predict_observe_moon(), predict_observe_sun()), but the needed properties are not dependent on an observer. Consistency requires a new function, e.g. predict_sun().
Some solution proposals:
Solution 1:
Add new structs, split into observation-independent and observation-dependent, in the same style as struct predict_orbit and struct predict_observation. For sun, it will be struct predict_sun and struct predict_observation, for moon it will be struct predict_moon and struct predict_observation.
struct predict_sun {
/* observation-independent properties we are missing for the sun, longitude, latitude, declination, ... */
};
predict_sun(predict_sun *sun, predict_julian_date_t time);
predict_observe_sun(const predict_observer_t *observer, const struct predict_sun *sun, struct predict_observation *obs);
struct predict_moon {
/* observation-independent properties we are missing for the moon, longitude, latitude, declination, ... */
};
void predict_moon(predict_moon *moon, predict_julian_date_t time);
void predict_observe_moon(const predict_observer_t *observer, const struct predict_moon *moon, struct predict_observation *obs);
Solution 2:
Unify moon and sun structs, since the fields are probably going to be the same anyway. Possible namings: celestial_body, celestial_object, astronomical_body, astronomical_object...
struct predict_celestial{
/* observation-independent properties we are missing */
};
void predict_sun(predict_celestial *orbit, predict_julian_date_t time);
void predict_observe_sun(const predict_observer *observer, struct predict_observation *obs, predict_julian_date_t time);
void predict_moon(predict_celestial *orbit, predict_julian_date_t time);
void predict_observe_moon(const predict_observer *observer, struct predict_observation *obs, predict_julian_date_t time);
Solution 3:
Instead of predict_sun and predict_moon, unify to a common function.
enum predict_celestial_body {
PREDICT_MOON,
PREDICT_SUN
};
predict_celestial_body(enum predict_celestial_body body, predict_celestial *orbit, predict_julian_date_t time);
predict_observe_celestial_body(const predict_observer_t *observer, const predict_celestial *orbit, struct predict_observation obs);
Could also be extended to other planets. :-)
Solution 4:
Reuse struct predict_orbit. It makes sense in some ways, since a lot of these fields are going to be the same and predict_observe_orbit can be reused also for the moon and sun, but it will also have some additional weirdness in that functions defined for satellites are suddenly going to work also on moon and sun and result in very undefined behavior. What is the doppler shift from the sun? :^) Some properties like "eclipsed" also do not make much sense.
Solution 5:
Don't provide the missing properties at all and say that they are not available in the API. :-P
Is there any cleaner solution (except for solution 5)?
from libpredict.
Related Issues (20)
- Contributor agreement, thomasing
- Contributor agreement, kvamtroe
- Contributor agreement, bjorgan HOT 1
- Contributor agreement, core-dd
- Contributor agreement, nickoe
- Build C++ with -Wall and -Werror
- Max elevation unit test slow for Molniya 1 and Sirius 1 HOT 2
- src/julian_date.c needs "#include <time.h>" for gmtime_r HOT 2
- Please add cmake options enabling/disabling static and shared libraries HOT 4
- Help needed for use in windows 10+MATLAB
- WGS84 zenith position of the sun & moon
- WGS84 day/night terminator
- International designator in predict_orbital_elements misses termination for long designators
- Is there a specified version for ARM Cortex M HOT 1
- Julien date HOT 6
- predict_julian_date_t is not a julian date
- building on Mac HOT 3
- building on RPi4 and buster gets compiler errors; but completes! HOT 3
- gcc-12.1.1 -Werror doesn't like your tests HOT 1
- Build fails on testcase_reader.cpp.o HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libpredict.