Isis 3 Programmer Reference
PolynomialBivariate.cpp
Go to the documentation of this file.
1 
23 #include <iostream>
24 #include "PolynomialBivariate.h"
25 
26 namespace Isis {
34  Isis::BasisFunction("PolynomialBivariate", 2, ((degree + 1) * (degree + 2)) / 2) {
35  p_degree = degree;
36  }
37 
45  void PolynomialBivariate::Expand(const std::vector<double> &vars) {
46  std::vector<std::vector<double> > terms;
47  terms.resize(p_degree + 1);
48  terms[0].push_back(1.0);
49  for(int i = 1; i <= p_degree; i++) {
50  for(int t = 0; t < (int)terms[i-1].size(); t++) {
51  terms[i].push_back(terms[i-1][t] * vars[0]);
52  if(t == ((int)terms[i-1].size() - 1)) {
53  terms[i].push_back(terms[i-1][t] * vars[1]);
54  }
55  }
56  }
57 
58  p_terms.clear();
59  for(int i = 0; i <= p_degree; i++) {
60  for(int t = 0; t < (int)terms[i].size(); t++) {
61  p_terms.push_back(terms[i][t]);
62  }
63  }
64  }
65 } // end namespace isis
66 
PolynomialBivariate(int degree)
Create a PolynomialBivariate object.
std::vector< double > p_terms
A vector of the terms in the equation.
void Expand(const std::vector< double > &vars)
This is the the overriding virtual function that provides the expansion of the two input variables in...
int p_degree
The order/degree of the polynomial.
Generic linear equation class.
Definition: BasisFunction.h:64
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31