Commit bf4a76e7 authored by Laurent Belcour's avatar Laurent Belcour

Reformating to allow output parametrizations

parent 3d2306a7
......@@ -38,9 +38,9 @@ class data
virtual int dimX() const { return _nX ; }
virtual int dimY() const { return _nY ; }
virtual params::type parametrization() const
virtual params::input parametrization() const
{
return params::UNKNOWN;
return params::UNKNOWN_INPUT;
}
protected:
......@@ -77,9 +77,9 @@ public: // methods
//! \brief contructor requires the definition of a base class that
//! has a parametrization, and a new parametrization.
data_params(const data* d, params::type param,
data_params(const data* d, params::input param,
data_params::clustrering method = data_params::none) :
_d(d), _param(param), _clustering_method(method)
_d(d), _param_in(param), _clustering_method(method)
{
_nX = params::dimension(param);
_nY = d->dimY();
......@@ -109,7 +109,7 @@ public: // methods
vec res(_nX + _nY);
vec in = _d->get(i);
params::convert(&in[0], _d->parametrization(), _param, &res[0]);
params::convert(&in[0], _d->parametrization(), _param_in, &res[0]);
memcpy(&res[_nX], &in[_d->dimX()], _nY*sizeof(double));
return res;
......@@ -138,6 +138,6 @@ public: // methods
protected:
// data object to interface
const data* _d;
params::type _param;
params::input _param_in;
data_params::clustrering _clustering_method;
};
......@@ -65,7 +65,13 @@ class function
virtual vec getMin() const { return _min ; }
virtual vec getMax() const { return _max ; }
virtual params::type parametrization() const { return params::UNKNOWN; }
//! \brief provide the parametrization of the function.
//! \note some function type can modify the parametrization to adapt
//! to the data.
virtual params::input parametrization() const
{
return params::UNKNOWN_INPUT;
}
protected: //data
......
......@@ -12,9 +12,10 @@ class params
{
public: // data
//! \brief list of all supported parametrization. An unsupported
//! parametrization will go under the name <em>unknown</em>.
enum type
//! \brief list of all supported parametrization for the input space.
//! An unsupported parametrization will go under the name
//! <em>unknown</em>.
enum input
{
ROMEIRO_TH_TD,
RUSIN_TH_TD,
......@@ -27,15 +28,27 @@ class params
ISOTROPIC_TD_PD, // Difference between two directions such as R and H
CARTESIAN,
SPHERICAL_TL_PL_TV_PV,
UNKNOWN
UNKNOWN_INPUT
};
//! \brief list of all supported parametrization for the output space.
//! An unsupported parametrization will go under the name
//! <em>unknown</em>.
enum output
{
INV_STERADIAN,
ENERGY,
RGB_COLOR,
XYZ_COLOR,
UNKNOWN_OUTPUT
};
public: // methods
//! \brief static function for input type convertion. This
//! function allocate the resulting vector.
static double* convert(const double* invec, params::type intype,
params::type outtype)
static double* convert(const double* invec, params::input intype,
params::input outtype)
{
int dim = dimension(outtype); // Get the size of the output vector
......@@ -57,8 +70,8 @@ class params
//! \brief static function for input type convertion. The outvec
//! resulting vector should be allocated with the correct
//! output size.
static void convert(const double* invec, params::type intype,
params::type outtype, double* outvec)
static void convert(const double* invec, params::input intype,
params::input outtype, double* outvec)
{
double temvec[6]; // Temp CARTESIAN vectors
to_cartesian(invec, intype, temvec);
......@@ -68,7 +81,7 @@ class params
//! \brief convert a input vector in a given parametrization to an
//! output vector in a cartesian parametrization, that is two 3d
//! vectors concatenated.
static void to_cartesian(const double* invec, params::type intype,
static void to_cartesian(const double* invec, params::input intype,
double* outvec)
{
switch(intype)
......@@ -112,7 +125,7 @@ class params
//! \brief convert a input CARTESIAN vector, that is two 3d vectors
//! concatenated to an output vector in a given parametrization.
static void from_cartesian(const double* invec, params::type outtype,
static void from_cartesian(const double* invec, params::input outtype,
double* outvec)
{
// Compute the half vector
......@@ -157,7 +170,7 @@ class params
}
//! \brief provide a dimension associated with a parametrization
static int dimension(params::type t)
static int dimension(params::input t)
{
switch(t)
{
......@@ -197,6 +210,29 @@ class params
}
}
//! \brief provide a dimension associated with a parametrization
static int dimension(params::output t)
{
switch(t)
{
// 1D Parametrizations
case params::INV_STERADIAN:
case params::ENERGY:
return 1;
break;
// 3D Parametrization
case params::RGB_COLOR:
case params::XYZ_COLOR:
return 3;
break;
default:
return -1;
break;
}
}
//! \brief from the 4D definition of a half vector parametrization,
//! export the cartesian coordinates.
static void half_to_cartesian(double theta_h, double phi_h,
......
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