1#ifndef AzimuthCurve_h__
2#define AzimuthCurve_h__
11 AzimuthCurve( std::vector<T> coeff, std::vector<double> aziAngle ){
12 MakeCofficients(coeff, aziAngle);
16 size_t size = coeff.size();
18 m_coeff =
new T[size];
19 for (
size_t i =0; i < size; i++){
20 m_coeff[i] = coeff[i];
24 T eval(
double angle ){
25 T retval = m_coeff[0];
26 for(
size_t j=1; j < ((m_coeff_size - 1) / 2 + 1); j++)
27 retval += m_coeff[j]*cos( j * angle);
28 for(
size_t j=((m_coeff_size - 1) / 2 + 1); j < m_coeff_size; j++)
29 retval += m_coeff[j]*sin( (j-(m_coeff_size - 1) / 2) * angle);
37 std::vector<T> eval( std::vector<T> angle ){
38 std::vector<T> retval; retval.resize(angle.size());
39 for(
size_t i=0; i < angle.size(); i++)
40 retval[i] = eval( angle[i] );
48 void MakeCofficients(std::vector<T> values, std::vector<double> aziAngle){
50 size_t size = values.size();
53 size_t N =
static_cast<size_t>(std::floor((size - 1) / 2));
55 m_coeff =
new T[m_coeff_size];
57 Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> A = Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>::Zero(m_coeff_size, m_coeff_size);
58 Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> B = Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>::Zero(m_coeff_size, 1);
59 Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> x = Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>::Zero(m_coeff_size, 1);
62 for(
size_t k=0; k < m_coeff_size; k++)
67 for(
size_t k=0; k < m_coeff_size; k++){
69 for (
size_t j = 1; j < N + 1; j++) {
70 A(k, j + 0) = cos(j * aziAngle[k]);
71 A(k, j + N) = sin(j * aziAngle[k]);
75 for(
size_t k=0; k < size; k++)
76 for(
size_t j=0; j < size; j++){
77 if( (std::abs(A(k,j)) < 1e-6) )
81 x = A.colPivHouseholderQr().solve(B);
82 for(
size_t k=0; k < size; k++)
Definition: AzimuthCurve.h:9