47 #define M_PI 3.14159265358979323846 55 inline double square(
const double & value) {
return value*value;}
82 static const double a = 6378137;
83 static const double b = 6356752.3142;
85 static const double ae =
acos(b/a);
86 static const double cos2_ae_earth =
square(
cos(ae));
87 static const double sin2_ae_earth =
square(
sin(ae));
99 out.z = (cos2_ae_earth*N+this->
altitude())*
sin(lat);
130 P_geocentric -= P_geocentric_ref;
135 out.x = -slon*P_geocentric.x + clon*P_geocentric.y;
136 out.y = -clon*slat*P_geocentric.x -slon*slat*P_geocentric.y + clat*P_geocentric.z;
137 out.z = clon*clat*P_geocentric.x + slon*clat*P_geocentric.y +slat*P_geocentric.z;
144 static const double a = 6378137;
145 static const double b = 6356752.3142;
147 const double sa2 = a*a;
148 const double sb2 = b*b;
150 const double e2 = (sa2 - sb2) / sa2;
151 const double ep2 = (sa2 - sb2) / sb2;
152 const double p =
std::sqrt(geocentric.x * geocentric.x + geocentric.y * geocentric.y);
153 const double theta =
atan2(geocentric.z * a, p * b);
157 geocentric.z + ep2 * b *
sin(theta) *
sin(theta) *
sin(theta),
158 p - e2 * a *
cos(theta) *
cos(theta) *
cos(theta));
162 const double N = sa2 /
std::sqrt(sa2 * clat * clat + sb2 * slat * slat);
177 cv::Point3f originGeocentric;
180 cv::Vec3d P_ref(originGeocentric.x, originGeocentric.y, originGeocentric.z);
183 cv::Vec3d REF_X, REF_Y, REF_Z;
193 cv::Vec3d AUX_X(-REF_Z[1], REF_Z[0], 0);
197 REF_Y = REF_Z.cross(REF_X);
199 cv::Point3d out_coords;
201 REF_X[0] * enu.x + REF_Y[0] * enu.y + REF_Z[0] * enu.z + originGeocentric.x;
203 REF_X[1] * enu.x + REF_Y[1] * enu.y + REF_Z[1] * enu.z + originGeocentric.y;
205 REF_X[2] * enu.x + REF_Y[2] * enu.y + REF_Z[2] * enu.z + originGeocentric.z;
GLM_FUNC_DECL vecType< T, P > sqrt(vecType< T, P > const &x)
double DEG2RAD(const double x)
double square(const double &value)
static cv::Point3d ENU_WGS84ToGeocentric_WGS84(const cv::Point3d &enu, const GeodeticCoords &origin)
void fromGeocentric_WGS84(const cv::Point3d &geocentric)
const double & altitude() const
const double & longitude() const
GLM_FUNC_DECL genType cos(genType const &angle)
GLM_FUNC_DECL genType normalize(genType const &x)
GLM_FUNC_DECL genType sin(genType const &angle)
cv::Point3d toGeocentric_WGS84() const
const double & latitude() const
double RAD2DEG(const double x)
GLM_FUNC_QUALIFIER T atan2(T x, T y)
Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what q...
cv::Point3d toENU_WGS84(const GeodeticCoords &origin) const
GLM_FUNC_DECL genType acos(genType const &x)
void fromENU_WGS84(const cv::Point3d &enu, const GeodeticCoords &origin)