| 
     
      
      
      From: Mathias F. <fro...@ba...> - 2010-05-02 23:02:53
      
     
   | 
Update of /var/cvs/FlightGear-0.9/source/src/Navaids In directory baron.flightgear.org:/tmp/cvs-serv29417/src/Navaids Modified Files: positioned.cxx positioned.hxx Log Message: Use methods from SGMath when possible. Modified Files: src/Airports/apt_loader.cxx src/Navaids/positioned.cxx src/Navaids/positioned.hxx Index: positioned.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/Navaids/positioned.cxx,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- positioned.cxx 20 Dec 2009 08:07:46 -0000 1.29 +++ positioned.cxx 2 May 2010 21:58:31 -0000 1.30 @@ -30,11 +30,10 @@ #include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/predicate.hpp> -#include <simgear/math/sg_geodesy.hxx> #include <simgear/timing/timestamp.hxx> #include <simgear/debug/logstream.hxx> #include <simgear/structure/exception.hxx> -#include <simgear/math/SGBox.hxx> +#include <simgear/math/SGGeometry.hxx> #include "positioned.hxx" @@ -55,27 +54,6 @@ const double LEAF_SIZE = SG_NM_TO_METER * 8.0; const double LEAF_SIZE_SQR = LEAF_SIZE * LEAF_SIZE; -typedef SGBox<double> SGBoxd; - -template<typename T1, typename T2> -inline bool -intersects(const SGVec3<T1>& v, const SGBox<T2>& box) -{ - if (v[0] < box.getMin()[0]) - return false; - if (box.getMax()[0] < v[0]) - return false; - if (v[1] < box.getMin()[1]) - return false; - if (box.getMax()[1] < v[1]) - return false; - if (v[2] < box.getMin()[2]) - return false; - if (box.getMax()[2] < v[2]) - return false; - return true; -} - /** * Decorate an object with a double value, and use that value to order * items, for the purpoises of the STL algorithms @@ -156,28 +134,11 @@ double distSqrToNearest(const SGVec3d& aPos) const { - return distSqr(aPos, getClosestPoint(aPos)); + return distSqr(aPos, _box.getClosestPoint(aPos)); } virtual void insert(FGPositioned* aP) = 0; - SGVec3d getClosestPoint(const SGVec3d& aPos) const - { - SGVec3d r; - - for (unsigned int i=0;i<3; ++i) { - if (aPos[i] < _box.getMin()[i]) { - r[i] = _box.getMin()[i]; - } else if (aPos[i] > _box.getMax()[i]) { - r[i] = _box.getMax()[i]; - } else { - r[i] = aPos[i]; - } - } // of axis iteration - - return r; - } - virtual void visit(const SGVec3d& aPos, double aCutoff, FGPositioned::Filter* aFilter, FindNearestResults& aResults, FindNearestPQueue&) = 0; @@ -728,12 +689,6 @@ return new FGPositioned(WAYPOINT, aIdent, aPos, true); } -SGBucket -FGPositioned::bucket() const -{ - return SGBucket(mPosition); -} - SGVec3d FGPositioned::cart() const { Index: positioned.hxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/Navaids/positioned.hxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- positioned.hxx 5 Oct 2009 20:00:44 -0000 1.12 +++ positioned.hxx 2 May 2010 21:59:33 -0000 1.13 @@ -24,7 +24,7 @@ #include <vector> #include <simgear/structure/SGSharedPtr.hxx> -#include <simgear/bucket/newbucket.hxx> +#include <simgear/math/SGMath.hxx> class FGPositioned; @@ -88,8 +88,6 @@ */ SGVec3d cart() const; - SGBucket bucket() const; - double latitude() const { return mPosition.getLatitudeDeg(); }  |