17 #ifndef __itkMultivariateLegendrePolynomial_h
18 #define __itkMultivariateLegendrePolynomial_h
100 {
return m_Dimension; }
103 unsigned int GetDegree(
void)
const
112 unsigned int GetNumberOfCoefficients(
void)
const
113 {
return m_NumberOfCoefficients; }
117 {
return m_DomainSize; }
125 m_Required = required;
150 if (m_Dimension == 2)
152 if (index[1] != m_PrevY)
155 double norm_y = m_NormFactor[1] *
156 static_cast<double>( index[1] - 1 );
157 this->CalculateXCoef(norm_y, m_CoefficientArray);
162 double norm_x = m_NormFactor[0] *
163 static_cast<double>( index[0] - 1 );
165 return LegendreSum(norm_x, m_Degree, m_CachedXCoef);
167 else if (m_Dimension == 3)
169 if (index[2] != m_PrevZ )
172 double norm_z = m_NormFactor[2] *
173 static_cast<double>( index[2] - 1 );
174 this->CalculateYCoef(norm_z, m_CoefficientArray);
178 if (index[1] != m_PrevY)
181 double norm_y = m_NormFactor[1] *
182 static_cast<double>( index[1] - 1 );
183 this->CalculateXCoef(norm_y, m_CachedYCoef);
188 double norm_x = m_NormFactor[0] *
189 static_cast<double>( index[0] - 1 );
190 return this->LegendreSum(norm_x, m_Degree, m_CachedXCoef);
196 unsigned int GetNumberOfCoefficients();
199 unsigned int GetNumberOfCoefficients(
unsigned int dimension,
unsigned int degree);
211 m_MultivariateLegendrePolynomial = polynomial;
212 m_Dimension = m_MultivariateLegendrePolynomial->
GetDimension();
213 m_DomainSize = m_MultivariateLegendrePolynomial->GetDomainSize();
214 m_Index.resize(m_Dimension);
215 std::fill(m_Index.begin(), m_Index.end(), 0);
221 for (
unsigned int dim = 0; dim < m_Dimension; dim++)
228 {
return m_IsAtEnd; }
232 for (
unsigned int dim = 0; dim < m_Dimension; dim++)
234 if (m_Index[dim] < static_cast<int>(m_DomainSize[dim] - 1))
241 if (dim == m_Dimension - 1 )
256 {
return m_MultivariateLegendrePolynomial->Evaluate(m_Index); }
266 void Print(std::ostream& os);
269 void PrintSelf(std::ostream& os,
Indent indent)
const;
270 double LegendreSum(
const double x,
int n,