OTB  9.0.0
Orfeo Toolbox
otbLogPolarTransform.hxx
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 otbLogPolarTransform_hxx
22 #define otbLogPolarTransform_hxx
23 
24 #include "otbLogPolarTransform.h"
25 #include "otbMacro.h"
26 #include "otbMath.h"
27 
28 namespace otb
29 {
33 template <class TScalarType>
35 {
36  m_Center[0] = 0.0;
37  m_Center[1] = 0.0;
38  m_Scale[0] = 1.0;
39  m_Scale[1] = 1.0;
40 }
41 
45 template <class TScalarType>
47 {
48 }
49 
54 template <class TScalarType>
56 {
57  m_Center[0] = parameters[0];
58  m_Center[1] = parameters[1];
59  m_Scale[0] = parameters[2];
60  m_Scale[1] = parameters[3];
61  otbMsgDebugMacro(<< "Call To SetParameters: Center=" << m_Center << ", Scale=" << m_Scale);
62  this->m_Parameters = parameters;
63  this->Modified();
64 }
65 
70 template <class TScalarType>
72 {
73  // Filling parameters vector
74  this->m_Parameters[0] = m_Center[0];
75  this->m_Parameters[1] = m_Center[1];
76  this->m_Parameters[2] = m_Scale[0];
77  this->m_Parameters[3] = m_Scale[1];
78 
79  return this->m_Parameters;
80 }
86 template <class TScalarType>
88 {
89  OutputPointType result;
90  double theta = point[0] * m_Scale[0] * CONST_PI_180;
91  double logRho = point[1] * m_Scale[1];
92  result[0] = m_Center[0];
93  result[1] = m_Center[1];
94  result[0] += std::exp(logRho) * std::cos(theta);
95  result[1] += std::exp(logRho) * std::sin(theta);
96  return result;
97 }
98 
104 template <class TScalarType>
106 {
107  OutputVectorType result;
108  double theta = vector[0] * m_Scale[0] * CONST_PI_180;
109  double logRho = vector[1] * m_Scale[1];
110  result[0] = 0.;
111  result[1] = 0.;
112  result[0] += std::exp(logRho) * std::cos(theta);
113  result[1] += std::exp(logRho) * std::sin(theta);
115 
116  return result;
117 }
123 template <class TScalarType>
125 {
126  OutputVnlVectorType result;
127  double theta = vector[0] * m_Scale[0] * CONST_PI_180;
128  double logRho = vector[1] * m_Scale[1];
129  result[0] = 0.;
130  result[1] = 0.;
131  result[0] += std::exp(logRho) * std::cos(theta);
132  result[1] += std::exp(logRho) * std::sin(theta);
134 
135  return result;
136 }
140 template <class TScalarType>
141 void LogPolarTransform<TScalarType>::PrintSelf(std::ostream& os, itk::Indent indent) const
142 {
143  Superclass::PrintSelf(os, indent);
144  os << indent << "Center: " << m_Center << std::endl;
145  os << indent << "Scale: " << m_Scale << std::endl;
146 }
148 
149 } // end namespace otb
150 #endif
otb::LogPolarTransform::ParametersType
Superclass::ParametersType ParametersType
Definition: otbLogPolarTransform.h:74
otb::LogPolarTransform::OutputVectorType
Superclass::OutputVectorType OutputVectorType
Definition: otbLogPolarTransform.h:71
otbLogPolarTransform.h
otb::LogPolarTransform::~LogPolarTransform
~LogPolarTransform() override
Definition: otbLogPolarTransform.hxx:46
otb::LogPolarTransform::m_Center
InputPointType m_Center
Definition: otbLogPolarTransform.h:152
otb::LogPolarTransform::InputPointType
Superclass::InputPointType InputPointType
Definition: otbLogPolarTransform.h:68
otb::LogPolarTransform::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbLogPolarTransform.hxx:141
otb::LogPolarTransform::OutputPointType
Superclass::OutputPointType OutputPointType
Definition: otbLogPolarTransform.h:69
otbMath.h
otb::LogPolarTransform::TransformVector
OutputVectorType TransformVector(const InputVectorType &vector) const override
Definition: otbLogPolarTransform.hxx:105
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbMacro.h
otb::LogPolarTransform::SetParameters
void SetParameters(const ParametersType &parameters) override
Definition: otbLogPolarTransform.hxx:55
otb::CONST_PI_180
constexpr double CONST_PI_180
Definition: otbMath.h:56
otb::LogPolarTransform::GetParameters
ParametersType & GetParameters(void) const override
Definition: otbLogPolarTransform.hxx:71
otb::LogPolarTransform::m_Scale
ScaleType m_Scale
Definition: otbLogPolarTransform.h:153
otb::Transform< TScalarType, 2, 2 >
otb::LogPolarTransform::LogPolarTransform
LogPolarTransform()
Definition: otbLogPolarTransform.hxx:34
otb::LogPolarTransform::OutputVnlVectorType
Superclass::OutputVnlVectorType OutputVnlVectorType
Definition: otbLogPolarTransform.h:73
otbMsgDebugMacro
#define otbMsgDebugMacro(x)
Definition: otbMacro.h:62
otb::LogPolarTransform::InputVnlVectorType
Superclass::InputVnlVectorType InputVnlVectorType
Definition: otbLogPolarTransform.h:72
otb::LogPolarTransform::TransformPoint
OutputPointType TransformPoint(const InputPointType &point) const override
Definition: otbLogPolarTransform.hxx:87
otb::LogPolarTransform::InputVectorType
Superclass::InputVectorType InputVectorType
Definition: otbLogPolarTransform.h:70