Commit 5caa362f authored by Laurent Belcour's avatar Laurent Belcour

Adding setting of the data, next export functions

parent 1c5a324f
......@@ -53,6 +53,9 @@ class data
//! should be compliant with the size and parametrization of the data.
virtual vec value(vec in, vec out) const = 0;
//! \brief Put the sample inside the data
virtual void set(vec x) = 0;
// Get data size, e.g. the number of samples to fit
virtual int size() const = 0 ;
......@@ -167,6 +170,12 @@ class data_params : public data
{
return this->get(i);
}
//! \todo This should crash at execution.
virtual void set(vec x)
{
this->set(x);
}
// Get data size, e.g. the number of samples to fit
virtual int size() const
......
......@@ -206,6 +206,14 @@ vec vertical_segment::get(int i) const
return _data[i] ;
}
//! \todo Check the vertical segment size and if the data
//! is not already present.
void vertical_segment::set(vec x)
{
assert(x.size() == _nX + _nY);
_data.push_back(x);
}
int vertical_segment::size() const
{
return _data.size() ;
......
......@@ -27,6 +27,9 @@ class vertical_segment : public data
std::cerr << "<<ERROR>> not implemented: " << __func__ << std::endl;
throw;
}
//! \brief Put the sample inside the data
virtual void set(vec x);
//! \brief Specific accessor to a vertical segment, this gives the
//! complete vector, plus the ordinate segment
......
......@@ -280,6 +280,21 @@ vec data_merl::operator[](int i) const
{
return get(i) ;
}
//! \todo Test this function
void data_merl::set(vec x)
{
assert(x.size() == 6);
const int phid_ind = (int)floor((x[2] / M_PI) * (BRDF_SAMPLING_RES_PHI_D/2));
const int thed_ind = (int)floor((x[1] / (0.5*M_PI)) * BRDF_SAMPLING_RES_THETA_D);
const int theh_ind = (int)floor((x[0] / (0.5*M_PI)) * BRDF_SAMPLING_RES_THETA_H);
const int i = (theh_ind*BRDF_SAMPLING_RES_THETA_D + thed_ind)*(BRDF_SAMPLING_RES_PHI_D/2) + phid_ind;
brdf[i] = x[3] / RED_SCALE;
brdf[i + BRDF_SAMPLING_RES_THETA_H*BRDF_SAMPLING_RES_THETA_D*BRDF_SAMPLING_RES_PHI_D/2] = x[4] / GREEN_SCALE;
brdf[i + BRDF_SAMPLING_RES_THETA_H*BRDF_SAMPLING_RES_THETA_D*BRDF_SAMPLING_RES_PHI_D] = x[5] / BLUE_SCALE;
}
vec data_merl::value(vec in, vec out) const
{
// compute thetain fi_in, theta_out fi_out
......
......@@ -21,6 +21,9 @@ class data_merl : public QObject, public data
virtual vec get(int i) const ;
virtual vec operator[](int i) const ;
virtual vec value(vec in, vec out) const ;
// Set data
virtual void set(vec x);
// Get data size, e.g. the number of samples to fit
virtual int size() const ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment