From: frohlich Date: Sat, 7 Mar 2009 11:10:57 +0000 (+0000) Subject: Add convenience function to keep position with just an other elevation. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=06ad73f85b3710bef0fe87e96351b6985fd69dda;p=simgear.git Add convenience function to keep position with just an other elevation. Modified Files: simgear/math/SGGeod.hxx --- 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)