osgEarth 2.1.1
|
00001 /* -*-c++-*- */ 00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph 00003 * Copyright 2008-2010 Pelican Mapping 00004 * http://osgearth.org 00005 * 00006 * osgEarth is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/> 00018 */ 00019 00020 #ifndef OSGEARTH_GEOMATH_H 00021 #define OSGEARTH_GEOMATH_H 1 00022 00023 #include <osgEarth/Common> 00024 #include <osgEarth/SpatialReference> 00025 #include <osg/CoordinateSystemNode> 00026 00027 namespace osgEarth 00028 { 00032 enum GeoInterpolation 00033 { 00034 GEOINTERP_GREAT_CIRCLE, 00035 GEOINTERP_RHUMB_LINE 00036 }; 00037 00042 class OSGEARTH_EXPORT GeoMath 00043 { 00044 public: 00060 static double distance(double lat1Rad, double lon1Rad, 00061 double lat2Rad, double lon2Rad, 00062 double radius = osg::WGS_84_RADIUS_EQUATOR); 00063 00068 static double distance(const std::vector< osg::Vec3d > &points, double radius = osg::WGS_84_RADIUS_EQUATOR); 00069 00073 static double distance(const osg::Vec3d& p1, const osg::Vec3d& p2, const SpatialReference* srs); 00074 00075 00089 static double bearing(double lat1Rad, double lon1Rad, 00090 double lat2Rad, double lon2Rad); 00091 00107 static void midpoint(double lat1Rad, double lon1Rad, 00108 double lat2Rad, double lon2Rad, 00109 double &out_latRad, double &out_lonRad); 00110 00128 static void destination(double lat1Rad, double lon1Rad, 00129 double bearingRad, double distance, 00130 double &out_latRad, double &out_lonRad, 00131 double radius = osg::WGS_84_RADIUS_EQUATOR); 00132 00148 static double rhumbDistance(double lat1Rad, double lon1Rad, 00149 double lat2Rad, double lon2Rad, 00150 double radius = osg::WGS_84_RADIUS_EQUATOR); 00151 00152 00157 static double rhumbDistance(const std::vector< osg::Vec3d > &points, double radius = osg::WGS_84_RADIUS_EQUATOR); 00158 00159 00171 static double rhumbBearing(double lat1Rad, double lon1Rad, 00172 double lat2Rad, double lon2Rad); 00173 00190 static void rhumbDestination(double lat1Rad, double lon1Rad, 00191 double bearing, double distance, 00192 double &out_latRad, double &out_lonRad, 00193 double radius = osg::WGS_84_RADIUS_EQUATOR); 00194 }; 00195 }; 00196 00197 #endif