Commit 3bd27e30 authored by Laurent Belcour's avatar Laurent Belcour

Got some plugins not added to the scons scripts to work under Ubuntu 14, 64b

parent 43a720b8
......@@ -138,7 +138,7 @@ void function::save_call(std::ostream&, const arguments&) const
}
//! \brief L2 norm to data.
double function::L2_distance(const ptr<data> d) const
double function::L2_distance(const ptr<data>& d) const
{
double l2_dist = 0.0;
for(int i=0; i<d->size(); ++i)
......@@ -163,7 +163,7 @@ double function::L2_distance(const ptr<data> d) const
}
//! \brief Linf norm to data.
double function::Linf_distance(const ptr<data> d) const
double function::Linf_distance(const ptr<data>& d) const
{
vec mean = vec::Zero(dimY());
vec var = vec::Zero(dimY());
......
......@@ -77,14 +77,14 @@ class function : public parametrized
//! If the measurement points are not uniformly distributed, then the
//! metric does not represent the real difference integrated over the
//! hemisphere.
double L2_distance(const ptr<data> d) const ;
double L2_distance(const ptr<data>& d) const ;
//! \brief Linf norm to data.
//! \note This distance is only valid with respect to the data sampling.
//! If the measurement points are not uniformly distributed, then the
//! metric does not represent the real difference integrated over the
//! hemisphere.
double Linf_distance(const ptr<data> d) const ;
double Linf_distance(const ptr<data>& d) const ;
};
......
......@@ -30,11 +30,11 @@ rational_fitter_cgal::~rational_fitter_cgal()
{
}
bool rational_fitter_cgal::fit_data(const ptr<data> dat, function* fit, const arguments &args)
bool rational_fitter_cgal::fit_data(const ptr<data> dat, function* fit, const arguments&)
{
rational_function* r = dynamic_cast<rational_function*>(fit) ;
const vertical_segment* d = dynamic_cast<const vertical_segment*>(dat) ;
if(r == NULL || d == NULL)
const ptr<vertical_segment> d = dynamic_pointer_cast<vertical_segment>(dat) ;
if(r == NULL || !d)
{
std::cerr << "<<ERROR>> not passing the correct class to the fitter" << std::endl ;
return false ;
......@@ -90,7 +90,7 @@ void rational_fitter_cgal::set_parameters(const arguments& args)
_min_nq = args.get_float("min-nq", _max_nq) ;
}
bool rational_fitter_cgal::fit_data(const vertical_segment* d, int np, int nq, rational_function* r)
bool rational_fitter_cgal::fit_data(const ptr<vertical_segment>& d, int np, int nq, rational_function* r)
{
// For each output dimension (color channel for BRDFs) perform
// a separate fit on the y-1D rational function.
......@@ -112,7 +112,7 @@ bool rational_fitter_cgal::fit_data(const vertical_segment* d, int np, int nq, r
// np and nq are the degree of the RP to fit to the data
// y is the dimension to fit on the y-data (e.g. R, G or B for RGB signals)
// the function return a ration BRDF function and a boolean
bool rational_fitter_cgal::fit_data(const vertical_segment* d, int np, int nq, int ny, rational_function_1d* r)
bool rational_fitter_cgal::fit_data(const ptr<vertical_segment>& d, int np, int nq, int ny, rational_function_1d* r)
{
// by default, we have a nonnegative QP with Ax - b >= 0
Program qp (CGAL::LARGER, false, 0, false, 0) ;
......
......@@ -11,6 +11,7 @@
#include <core/vertical_segment.h>
#include <core/fitter.h>
#include <core/args.h>
#include <core/ptr.h>
/*! \brief A vertical segment fitter for rational function using the library CGAL
* \ingroup plugins
......@@ -34,8 +35,8 @@ class rational_fitter_cgal : public fitter
// Fitting a data object using np elements in the numerator and nq
// elements in the denominator
virtual bool fit_data(const vertical_segment* d, int np, int nq, rational_function* fit) ;
virtual bool fit_data(const vertical_segment* dat, int np, int nq, int ny, rational_function_1d* fit) ;
virtual bool fit_data(const ptr<vertical_segment>& d, int np, int nq, rational_function* fit) ;
virtual bool fit_data(const ptr<vertical_segment>& dat, int np, int nq, int ny, rational_function_1d* fit) ;
// min and Max usable np and nq values for the fitting
int _max_np, _max_nq ;
......
......@@ -169,7 +169,7 @@ class quadratic_program
//! \brief Test all the constraints of the data.
//! Add the sample that is farest away from the function.
bool test_constraints(int ny, const rational_function_1d* r, const vertical_segment* data)
bool test_constraints(int ny, const rational_function_1d* r, const ptr<vertical_segment>& data)
{
#ifdef PACANOWSKI2012
int nb_failed = 0;
......@@ -253,7 +253,7 @@ class quadratic_program
//! \brief Give the next position in the data that is not satisfied.
//! This method works only for a single color channel ny !
static int next_unmatching_constraint(int i, int ny, const rational_function_1d* r,
const vertical_segment* data);
const ptr<vertical_segment>& data);
protected:
int _np, _nq;
......@@ -296,7 +296,7 @@ inline void quadratic_program::get_constraint(const vec& xi, const vec& yl, cons
}
int quadratic_program::next_unmatching_constraint(int i, int ny, const rational_function_1d* r,
const vertical_segment* data)
const ptr<vertical_segment>& data)
{
for(int n=i; n<data->size(); ++n)
{
......
......@@ -41,13 +41,13 @@ bool rational_fitter_parallel::fit_data(const ptr<data> dat, function* fit, cons
return false ;
}
const vertical_segment* d = dynamic_cast<const vertical_segment*>(dat) ;
if(d == NULL)
ptr<vertical_segment> d = dynamic_pointer_cast<vertical_segment>(dat) ;
if(!d)
{
std::cerr << "<<WARNING>> automatic convertion of the data object to vertical_segment," << std::endl;
std::cerr << "<<WARNING>> we advise you to perform convertion with a separate command." << std::endl;
vertical_segment* vs = new vertical_segment();
ptr<vertical_segment> vs(new vertical_segment());
for(int i=0; i<dat->size(); ++i)
{
const vec x = dat->get(i);
......@@ -201,7 +201,7 @@ void rational_fitter_parallel::set_parameters(const arguments&)
}
bool rational_fitter_parallel::fit_data(const vertical_segment* d, int np, int nq,
bool rational_fitter_parallel::fit_data(const ptr<vertical_segment>& d, int np, int nq,
rational_function* r, const arguments &args,
double& delta, double& linf_dist, double& l2_dist)
{
......@@ -220,8 +220,8 @@ bool rational_fitter_parallel::fit_data(const vertical_segment* d, int np, int n
rf->update(p, q);
}
linf_dist = r->Linf_distance(d);
l2_dist = r->L2_distance(d);
linf_dist = r->Linf_distance(dynamic_pointer_cast<data>(d));
l2_dist = r->L2_distance(dynamic_pointer_cast<data>(d));
return true ;
}
......@@ -230,7 +230,7 @@ bool rational_fitter_parallel::fit_data(const vertical_segment* d, int np, int n
// np and nq are the degree of the RP to fit to the data
// y is the dimension to fit on the y-data (e.g. R, G or B for RGB signals)
// the function returns a rational BRDF function and a boolean
bool rational_fitter_parallel::fit_data(const vertical_segment* d, int np, int nq, int ny,
bool rational_fitter_parallel::fit_data(const ptr<vertical_segment>& d, int np, int nq, int ny,
rational_function_1d* r, const arguments& args,
vec& p, vec& q, double& delta)
{
......@@ -295,7 +295,7 @@ bool rational_fitter_parallel::fit_data(const vertical_segment* d, int np, int n
}
void rational_fitter_parallel::get_constraint(int i, int np, int nq, int ny,
const vertical_segment* data,
const ptr<vertical_segment>& data,
const rational_function_1d* func,
vec& cu, vec& cl)
{
......
......@@ -58,10 +58,10 @@ class rational_fitter_parallel : public fitter
// Fitting a data object using np elements in the numerator and nq
// elements in the denominator
virtual bool fit_data(const vertical_segment* d, int np, int nq,
virtual bool fit_data(const ptr<vertical_segment>& d, int np, int nq,
rational_function* fit, const arguments &args,
double& delta, double& linf_dist,double& l2_dist) ;
virtual bool fit_data(const vertical_segment* dat, int np, int nq,
virtual bool fit_data(const ptr<vertical_segment>& dat, int np, int nq,
int ny, rational_function_1d* fit, const arguments& args,
vec& p, vec& q, double& delta) ;
......@@ -71,7 +71,7 @@ class rational_fitter_parallel : public fitter
//! corresponding to the lower constraint and the upper constraint
//! of the vertical segment.
virtual void get_constraint(int i, int np, int nq, int ny,
const vertical_segment* data,
const ptr<vertical_segment>& data,
const rational_function_1d* func,
vec& cu, vec& cl);
......
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