From: frohlich Date: Sun, 29 Jul 2007 10:51:41 +0000 (+0000) Subject: Modified Files: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ed677676c0a291201ab78ebace9437b41b5a09bf;p=flightgear.git Modified Files: src/Scenery/scenery.cxx: Use geodetic down vector for ground intersection. --- diff --git a/src/Scenery/scenery.cxx b/src/Scenery/scenery.cxx index e7d33aba8..110631b3f 100644 --- a/src/Scenery/scenery.cxx +++ b/src/Scenery/scenery.cxx @@ -122,22 +122,23 @@ FGScenery::get_elevation_m(double lat, double lon, double max_alt, } bool -FGScenery::get_elevation_m(const SGGeod& geod, - double& alt, const SGMaterial** material) +FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff, + double& alt, const SGMaterial** material) { - SGVec3d pos = SGVec3d::fromGeod(geod); - return get_cart_elevation_m(pos, 0, alt, material); + SGGeod geod = SGGeod::fromCart(pos); + geod.setElevationM(geod.getElevationM() + max_altoff); + return get_elevation_m(geod, alt, material); } bool -FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff, - double& alt, const SGMaterial** material) +FGScenery::get_elevation_m(const SGGeod& geod, double& alt, + const SGMaterial** material) { - if ( norm1(pos) < 1 ) - return false; + SGVec3d start = SGVec3d::fromGeod(geod); - SGVec3d start = pos + max_altoff*normalize(pos); - SGVec3d end(0, 0, 0); + SGGeod geodEnd = geod; + geodEnd.setElevationM(SGMiscd::min(geod.getElevationM() - 10, -10000)); + SGVec3d end = SGVec3d::fromGeod(geodEnd); osgUtil::IntersectVisitor intersectVisitor; intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);