123456789101112131415161718192021222324252627282930 |
- #include "Sub.h"
- Vector3f Sub::pv_location_to_vector(const Location& loc)
- {
- Location origin;
- if (!ahrs.get_origin(origin)) {
- origin.zero();
- }
- float alt_above_origin = pv_alt_above_origin(loc.alt);
- return Vector3f((loc.lat-origin.lat) * LATLON_TO_CM, (loc.lng-origin.lng) * LATLON_TO_CM * scaleLongDown, alt_above_origin);
- }
- float Sub::pv_alt_above_origin(float alt_above_home_cm)
- {
- Location origin;
- if (!ahrs.get_origin(origin)) {
- origin.zero();
- }
- return alt_above_home_cm + (ahrs.get_home().alt - origin.alt);
- }
|