OTB  9.0.0
Orfeo Toolbox
otbGeocentricTransform.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbGeocentricTransform_h
22 #define otbGeocentricTransform_h
23 
25 #include "otbTransform.h"
26 
27 namespace otb
28 {
36 template <TransformDirection TDirectionOfMapping, class TScalarType = double>
37 class ITK_EXPORT GeocentricTransform : public Transform<TScalarType, // Data type for scalars
38  3, // Number of dimensions in the input space
39  3> // Number of dimensions in the output space
40 {
41 public:
45  typedef itk::SmartPointer<Self> Pointer;
46  typedef itk::SmartPointer<const Self> ConstPointer;
47 
49  typedef itk::Point<ScalarType, 3> InputPointType;
50  typedef itk::Point<ScalarType, 3> OutputPointType;
51 
52 
54  itkNewMacro(Self);
55 
57  itkTypeMacro(GeocentricTransform, Transform);
58 
59  static const TransformDirection DirectionOfMapping = TDirectionOfMapping;
60 
61  itkStaticConstMacro(InputSpaceDimension, unsigned int, 3);
62  itkStaticConstMacro(OutputSpaceDimension, unsigned int, 3);
63  itkStaticConstMacro(SpaceDimension, unsigned int, 3);
64  itkStaticConstMacro(ParametersDimension, unsigned int, 3*(3 + 1));
65 
66  OutputPointType TransformPoint(const InputPointType& point) const override;
67 
68 protected:
69  GeocentricTransform() : Superclass(ParametersDimension) {};
70  ~GeocentricTransform() override = default;
71 
72 private:
73  GeocentricTransform(const Self&) = delete;
74  void operator=(const Self&) = delete;
75 };
76 
77 namespace Projection
78 {
86 template <class TScalarType = double>
88 {
89 
91  static constexpr TScalarType a = 6378137.;
92 
94  static constexpr TScalarType b = 6356752.314245;
95 
97  static constexpr TScalarType f = (a - b) / a;
98 
100  static constexpr TScalarType es = 1 - (b * b) / (a * a);
101 };
102 
112 template <class TScalarType = double, class TEllipsoid = WGS84Ellipsoid<TScalarType>>
113 itk::Point<TScalarType, 3> WorldToEcef(const itk::Point<TScalarType, 3> & worldPoint);
114 
123 template <class TScalarType = double, class TEllipsoid = WGS84Ellipsoid<TScalarType>>
124 itk::Point<TScalarType, 3> EcefToWorld(const itk::Point<TScalarType, 3> & ecefPoint);
125 
126 } // namespace Projection
127 
128 } // namespace otb
129 
130 #ifndef OTB_MANUAL_INSTANTIATION
132 #endif
133 
134 #endif
otb::TransformDirection
TransformDirection
Definition: otbTransform.h:30
otb::GeocentricTransform
Convert coordinates from geocentric (X, Y, Z) to geographic (lon, lat, h)
Definition: otbGeocentricTransform.h:37
otb::GeocentricTransform::Superclass
Transform< TScalarType, 3, 3 > Superclass
Definition: otbGeocentricTransform.h:44
otb::GeocentricTransform::ScalarType
Superclass::ScalarType ScalarType
Definition: otbGeocentricTransform.h:48
otbGeocentricTransform.hxx
otb::Projection::WGS84Ellipsoid::es
static constexpr TScalarType es
Definition: otbGeocentricTransform.h:100
otbTransform.h
otb::Transform< double, 3, 3 >::ScalarType
double ScalarType
Definition: otbTransform.h:71
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::GeocentricTransform::OutputPointType
itk::Point< ScalarType, 3 > OutputPointType
Definition: otbGeocentricTransform.h:50
otb::GeocentricTransform::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbGeocentricTransform.h:46
otb::GeocentricTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGeocentricTransform.h:45
otb::Projection::WGS84Ellipsoid::b
static constexpr TScalarType b
Definition: otbGeocentricTransform.h:94
otbCoordinateTransformation.h
otb::Transform
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:39
otb::Projection::EcefToWorld
itk::Point< TScalarType, 3 > EcefToWorld(const itk::Point< TScalarType, 3 > &ecefPoint)
Definition: otbGeocentricTransform.hxx:70
otb::Projection::WGS84Ellipsoid::a
static constexpr TScalarType a
Definition: otbGeocentricTransform.h:91
otb::GeocentricTransform::InputPointType
itk::Point< ScalarType, 3 > InputPointType
Definition: otbGeocentricTransform.h:49
otb::Projection::WGS84Ellipsoid
a structure holding the ellipsoid parameters for WGS84
Definition: otbGeocentricTransform.h:87
otb::GeocentricTransform::GeocentricTransform
GeocentricTransform()
Definition: otbGeocentricTransform.h:69
otb::GeocentricTransform::Self
GeocentricTransform Self
Definition: otbGeocentricTransform.h:43
otb::Projection::WGS84Ellipsoid::f
static constexpr TScalarType f
Definition: otbGeocentricTransform.h:97
otb::Projection::WorldToEcef
itk::Point< TScalarType, 3 > WorldToEcef(const itk::Point< TScalarType, 3 > &worldPoint)
Definition: otbGeocentricTransform.hxx:50