Geocentric.hpp | Geocentric.hpp | |||
---|---|---|---|---|
/** | /** | |||
* \file Geocentric.hpp | * \file Geocentric.hpp | |||
* \brief Header for GeographicLib::Geocentric class | * \brief Header for GeographicLib::Geocentric class | |||
* | * | |||
* Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> | |||
* and licensed under the LGPL. For more information, see | * and licensed under the LGPL. For more information, see | |||
* http://geographiclib.sourceforge.net/ | * http://geographiclib.sourceforge.net/ | |||
**********************************************************************/ | **********************************************************************/ | |||
#if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP) | #if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP) | |||
#define GEOGRAPHICLIB_GEOCENTRIC_HPP "$Id: e3512898a482b7eccb92d2ca020e63ae f5614446 $" | #define GEOGRAPHICLIB_GEOCENTRIC_HPP "$Id: 42003fa7ad2a422cf52cc3eff6fa6360 bb25d774 $" | |||
#include <vector> | #include <vector> | |||
#include <algorithm> | #include <algorithm> | |||
#include <GeographicLib/Constants.hpp> | #include <GeographicLib/Constants.hpp> | |||
namespace GeographicLib { | namespace GeographicLib { | |||
/** | /** | |||
* \brief %Geocentric coordinates | * \brief %Geocentric coordinates | |||
* | * | |||
skipping to change at line 122 | skipping to change at line 122 | |||
* @param[out] z geocentric coordinate (meters). | * @param[out] z geocentric coordinate (meters). | |||
* @param[out] M if the length of the vector is 9, fill with the rotati on | * @param[out] M if the length of the vector is 9, fill with the rotati on | |||
* matrix in row-major order. | * matrix in row-major order. | |||
* | * | |||
* Pre-multiplying a unit vector in local cartesian coordinates (east, | * Pre-multiplying a unit vector in local cartesian coordinates (east, | |||
* north, up) by \e M transforms the vector to geocentric coordinates. | * north, up) by \e M transforms the vector to geocentric coordinates. | |||
********************************************************************** / | ********************************************************************** / | |||
void Forward(real lat, real lon, real h, real& x, real& y, real& z, | void Forward(real lat, real lon, real h, real& x, real& y, real& z, | |||
std::vector<real>& M) | std::vector<real>& M) | |||
const throw() { | const throw() { | |||
real t[dim2_]; | if (M.end() == M.begin() + dim2_) { | |||
IntForward(lat, lon, h, x, y, z, t); | real t[dim2_]; | |||
if (M.end() == M.begin() + dim2_) | IntForward(lat, lon, h, x, y, z, t); | |||
copy(t, t + dim2_, M.begin()); | copy(t, t + dim2_, M.begin()); | |||
} else | ||||
IntForward(lat, lon, h, x, y, z, NULL); | ||||
} | } | |||
/** | /** | |||
* Convert from geocentric to geodetic to coordinates. | * Convert from geocentric to geodetic to coordinates. | |||
* | * | |||
* @param[in] x geocentric coordinate (meters). | * @param[in] x geocentric coordinate (meters). | |||
* @param[in] y geocentric coordinate (meters). | * @param[in] y geocentric coordinate (meters). | |||
* @param[in] z geocentric coordinate (meters). | * @param[in] z geocentric coordinate (meters). | |||
* @param[out] lat latitude of point (degrees). | * @param[out] lat latitude of point (degrees). | |||
* @param[out] lon longitude of point (degrees). | * @param[out] lon longitude of point (degrees). | |||
skipping to change at line 171 | skipping to change at line 173 | |||
* @param[out] M if the length of the vector is 9, fill with the rotati on | * @param[out] M if the length of the vector is 9, fill with the rotati on | |||
* matrix in row-major order. | * matrix in row-major order. | |||
* | * | |||
* Pre-multiplying a unit vector in geocentric coordinates by the trans pose | * Pre-multiplying a unit vector in geocentric coordinates by the trans pose | |||
* of \e M transforms the vector to local cartesian coordinates (east, | * of \e M transforms the vector to local cartesian coordinates (east, | |||
* north, up). | * north, up). | |||
********************************************************************** / | ********************************************************************** / | |||
void Reverse(real x, real y, real z, real& lat, real& lon, real& h, | void Reverse(real x, real y, real z, real& lat, real& lon, real& h, | |||
std::vector<real>& M) | std::vector<real>& M) | |||
const throw() { | const throw() { | |||
real t[dim2_]; | if (M.end() == M.begin() + dim2_) { | |||
IntReverse(x, y, z, lat, lon, h, t); | real t[dim2_]; | |||
if (M.end() == M.begin() + dim2_) | IntReverse(x, y, z, lat, lon, h, t); | |||
copy(t, t + dim2_, M.begin()); | copy(t, t + dim2_, M.begin()); | |||
} else | ||||
IntReverse(x, y, z, lat, lon, h, NULL); | ||||
} | } | |||
/** \name Inspector functions | /** \name Inspector functions | |||
********************************************************************** / | ********************************************************************** / | |||
///@{ | ///@{ | |||
/** | /** | |||
* @return \e a the equatorial radius of the ellipsoid (meters). This is | * @return \e a the equatorial radius of the ellipsoid (meters). This is | |||
* the value used in the constructor. | * the value used in the constructor. | |||
********************************************************************** / | ********************************************************************** / | |||
Math::real MajorRadius() const throw() { return _a; } | Math::real MajorRadius() const throw() { return _a; } | |||
End of changes. 5 change blocks. | ||||
7 lines changed or deleted | 11 lines changed or added | |||
LocalCartesian.hpp | LocalCartesian.hpp | |||
---|---|---|---|---|
/** | /** | |||
* \file LocalCartesian.hpp | * \file LocalCartesian.hpp | |||
* \brief Header for GeographicLib::LocalCartesian class | * \brief Header for GeographicLib::LocalCartesian class | |||
* | * | |||
* Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> | |||
* and licensed under the LGPL. For more information, see | * and licensed under the LGPL. For more information, see | |||
* http://geographiclib.sourceforge.net/ | * http://geographiclib.sourceforge.net/ | |||
**********************************************************************/ | **********************************************************************/ | |||
#if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP) | #if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP) | |||
#define GEOGRAPHICLIB_LOCALCARTESIAN_HPP "$Id: f9346d8010f4b5b4e74a65961b47 2c73578dfbfe $" | #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP "$Id: d20959dd365321594acba2a7dea5 cd4dedfbf66a $" | |||
#include <GeographicLib/Geocentric.hpp> | #include <GeographicLib/Geocentric.hpp> | |||
#include <GeographicLib/Constants.hpp> | #include <GeographicLib/Constants.hpp> | |||
namespace GeographicLib { | namespace GeographicLib { | |||
/** | /** | |||
* \brief Local Cartesian coordinates | * \brief Local Cartesian coordinates | |||
* | * | |||
* Convert between geodetic coordinates latitude = \e lat, longitude = \e | * Convert between geodetic coordinates latitude = \e lat, longitude = \e | |||
skipping to change at line 122 | skipping to change at line 122 | |||
* @param[out] M if the length of the vector is 9, fill with the rotati on | * @param[out] M if the length of the vector is 9, fill with the rotati on | |||
* matrix in row-major order. | * matrix in row-major order. | |||
* | * | |||
* Pre-multiplying a unit vector in local cartesian coordinates at (lat , | * Pre-multiplying a unit vector in local cartesian coordinates at (lat , | |||
* lon, h) by \e M transforms the vector to local cartesian coordinates at | * lon, h) by \e M transforms the vector to local cartesian coordinates at | |||
* (lat0, lon0, h0). | * (lat0, lon0, h0). | |||
********************************************************************** / | ********************************************************************** / | |||
void Forward(real lat, real lon, real h, real& x, real& y, real& z, | void Forward(real lat, real lon, real h, real& x, real& y, real& z, | |||
std::vector<real>& M) | std::vector<real>& M) | |||
const throw() { | const throw() { | |||
real t[dim2_]; | if (M.end() == M.begin() + dim2_) { | |||
IntForward(lat, lon, h, x, y, z, t); | real t[dim2_]; | |||
if (M.end() == M.begin() + dim2_) | IntForward(lat, lon, h, x, y, z, t); | |||
copy(t, t + dim2_, M.begin()); | copy(t, t + dim2_, M.begin()); | |||
} else | ||||
IntForward(lat, lon, h, x, y, z, NULL); | ||||
} | } | |||
/** | /** | |||
* Convert from local cartesian to geodetic coordinates. | * Convert from local cartesian to geodetic coordinates. | |||
* | * | |||
* @param[in] x local cartesian coordinate (meters). | * @param[in] x local cartesian coordinate (meters). | |||
* @param[in] y local cartesian coordinate (meters). | * @param[in] y local cartesian coordinate (meters). | |||
* @param[in] z local cartesian coordinate (meters). | * @param[in] z local cartesian coordinate (meters). | |||
* @param[out] lat latitude of point (degrees). | * @param[out] lat latitude of point (degrees). | |||
* @param[out] lon longitude of point (degrees). | * @param[out] lon longitude of point (degrees). | |||
skipping to change at line 165 | skipping to change at line 167 | |||
* @param[out] M if the length of the vector is 9, fill with the rotati on | * @param[out] M if the length of the vector is 9, fill with the rotati on | |||
* matrix in row-major order. | * matrix in row-major order. | |||
* | * | |||
* Pre-multiplying a unit vector in local cartesian coordinates at (lat 0, | * Pre-multiplying a unit vector in local cartesian coordinates at (lat 0, | |||
* lon0, h0) by the transpose of \e M transforms the vector to local | * lon0, h0) by the transpose of \e M transforms the vector to local | |||
* cartesian coordinates at (lat, lon, h). | * cartesian coordinates at (lat, lon, h). | |||
********************************************************************** / | ********************************************************************** / | |||
void Reverse(real x, real y, real z, real& lat, real& lon, real& h, | void Reverse(real x, real y, real z, real& lat, real& lon, real& h, | |||
std::vector<real>& M) | std::vector<real>& M) | |||
const throw() { | const throw() { | |||
real t[dim2_]; | if (M.end() == M.begin() + dim2_) { | |||
IntReverse(x, y, z, lat, lon, h, t); | real t[dim2_]; | |||
if (M.end() == M.begin() + dim2_) | IntReverse(x, y, z, lat, lon, h, t); | |||
copy(t, t + dim2_, M.begin()); | copy(t, t + dim2_, M.begin()); | |||
} else | ||||
IntReverse(x, y, z, lat, lon, h, NULL); | ||||
} | } | |||
/** \name Inspector functions | /** \name Inspector functions | |||
********************************************************************** / | ********************************************************************** / | |||
///@{ | ///@{ | |||
/** | /** | |||
* @return latitude of the origin (degrees). | * @return latitude of the origin (degrees). | |||
********************************************************************** / | ********************************************************************** / | |||
Math::real LatitudeOrigin() const throw() { return _lat0; } | Math::real LatitudeOrigin() const throw() { return _lat0; } | |||
End of changes. 5 change blocks. | ||||
7 lines changed or deleted | 11 lines changed or added | |||