From 06ad73f85b3710bef0fe87e96351b6985fd69dda Mon Sep 17 00:00:00 2001 From: frohlich Date: Sat, 7 Mar 2009 11:10:57 +0000 Subject: [PATCH] Add convenience function to keep position with just an other elevation. Modified Files: simgear/math/SGGeod.hxx --- simgear/math/SGGeod.hxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/simgear/math/SGGeod.hxx b/simgear/math/SGGeod.hxx index 4fea57ac..144ee347 100644 --- a/simgear/math/SGGeod.hxx +++ b/simgear/math/SGGeod.hxx @@ -42,6 +42,10 @@ public: static SGGeod fromRadM(double lon, double lat, double elevation); /// Factory from angular values in degrees and elevation in m static SGGeod fromDegM(double lon, double lat, double elevation); + /// Factory from an other SGGeod and a different elevation in m + static SGGeod fromGeodM(const SGGeod& geod, double elevation); + /// Factory from an other SGGeod and a different elevation in ft + static SGGeod fromGeodFt(const SGGeod& geod, double elevation); /// Factory to convert position from a cartesian position assumed to be /// in wgs84 measured in meters /// Note that this conversion is relatively expensive to compute @@ -192,6 +196,20 @@ SGGeod::fromDegM(double lon, double lat, double elevation) #endif } +inline +SGGeod +SGGeod::fromGeodM(const SGGeod& geod, double elevation) +{ + return SGGeod(geod._lon, geod._lat, elevation); +} + +inline +SGGeod +SGGeod::fromGeodFt(const SGGeod& geod, double elevation) +{ + return SGGeod(geod._lon, geod._lat, elevation*SG_FEET_TO_METER); +} + inline SGGeod SGGeod::fromCart(const SGVec3& cart) -- 2.39.5