Commit df220034 authored by Laurent Belcour's avatar Laurent Belcour

Small correction to the RF

parent daa6dce3
......@@ -516,12 +516,15 @@ void rational_function::save_matlab(const std::string& filename, const arguments
file << "\tp(" << j+1 << ",:) = ";
for(unsigned int i=0; i<np; ++i)
{
if(i > 0 && a[np*j + i] >= 0.0)
if(i > 0 && a[i] >= 0.0)
{
file << " + ";
else if(a[np*j + i] < 0.0)
}
else if(a[i] < 0.0)
{
file << " " ;
file << a[np*j + i];
}
file << a[i];
std::vector<int> degree = rf->index2degree(i);
for(unsigned int k=0; k<degree.size(); ++k)
......@@ -536,12 +539,15 @@ void rational_function::save_matlab(const std::string& filename, const arguments
file << "\tq(" << j+1 << ",:) = ";
for(unsigned int i=0; i<nq; ++i)
{
if(i > 0 && b[np*j + i] >= 0.0)
if(i > 0 && b[i] >= 0.0)
{
file << " + ";
else if(b[np*j + i] < 0.0)
}
else if(b[i] < 0.0)
{
file << " " ;
file << b[np*j + i] ;
}
file << b[i] ;
std::vector<int> degree = rf->index2degree(i);
for(unsigned int k=0; k<degree.size(); ++k)
......@@ -625,11 +631,15 @@ void rational_function::save_cpp(const std::string& filename, const arguments& a
file << "\tp = ";
for(unsigned int i=0; i<np; ++i)
{
if(i > 0 && a[np*j + i] >= 0.0)
if(i > 0 && a[i] >= 0.0)
{
file << " + ";
}
file << a[np*j + i];
else if(a[i] < 0.0)
{
file << " " ;
}
file << a[i];
std::vector<int> degree = rf->index2degree(i);
for(unsigned int k=0; k<degree.size(); ++k)
......@@ -643,12 +653,15 @@ void rational_function::save_cpp(const std::string& filename, const arguments& a
file << "\tq = ";
for(unsigned int i=0; i<nq; ++i)
{
if(i > 0 && b[np*j + i] >= 0.0)
if(i > 0 && b[i] >= 0.0)
{
file << " + ";
else if(b[np*j + i] < 0.0)
}
else if(b[i] < 0.0)
{
file << " " ;
file << b[np*j + i] ;
}
file << b[i] ;
std::vector<int> degree = rf->index2degree(i);
for(unsigned int k=0; k<degree.size(); ++k)
......
......@@ -413,5 +413,3 @@ ALTA_DLL_EXPORT data* provide_data()
}
Q_EXPORT_PLUGIN2(data_merl, data_merl)
#pragma once
#include <QObject>
#include <core/data.h>
#include <core/common.h>
#include <core/args.h>
class data_merl : public QObject, public data
class data_merl : public data
{
// Q_OBJECT
Q_INTERFACES(data)
public: // methods
data_merl();
......
......@@ -529,4 +529,3 @@ void lafortune_function::save_brdfexplorer(const std::string& filename,
}
Q_EXPORT_PLUGIN2(lafortune_function, lafortune_function)
......@@ -5,7 +5,6 @@
#include <string>
// Interface
#include <QObject>
#include <core/function.h>
#include <core/rational_function.h>
#include <core/data.h>
......@@ -24,12 +23,9 @@
* version where the M matrix is diagonal of coefficients \f$(Cx, Cy, Cz)\f$
* \todo Fitting the diffuse part is not stable
*/
class lafortune_function : public nonlinear_function, public QObject
class lafortune_function : public nonlinear_function
{
// Q_OBJECT
Q_INTERFACES(function)
public: // methods
lafortune_function() : _n(1), _isotropic(false) { }
......
......@@ -221,5 +221,3 @@ void phong_function::save_brdfexplorer(const std::string& filename,
file.close();
}
Q_EXPORT_PLUGIN2(phong_function, phong_function)
......@@ -5,7 +5,6 @@
#include <string>
// Interface
#include <QObject>
#include <core/function.h>
#include <core/rational_function.h>
#include <core/data.h>
......@@ -21,12 +20,9 @@
* A phong lobe is defined as \f$k_d + k_s |N.H|^a\f$
* \todo Finish implementation
*/
class phong_function : public nonlinear_function, public QObject
class phong_function : public nonlinear_function
{
// Q_OBJECT
Q_INTERFACES(function)
public: // methods
// Overload the function operator
......
......@@ -19,16 +19,6 @@ ALTA_DLL_EXPORT fitter* provide_fitter()
return new rational_fitter_eigen();
}
data* rational_fitter_eigen::provide_data() const
{
return new vertical_segment() ;
}
function* rational_fitter_eigen::provide_function() const
{
return new rational_function() ;
}
rational_fitter_eigen::rational_fitter_eigen()
{
}
......
......@@ -19,29 +19,24 @@ class rational_fitter_eigen : public fitter
{
public: // methods
rational_fitter_eigen() ;
virtual ~rational_fitter_eigen() ;
// Fitting a data object
//
virtual bool fit_data(const data* d, function* fit, const arguments& args) ;
virtual bool fit_data(const data* d, function* fit, const arguments& args) ;
// Provide user parameters to the fitter
//
virtual void set_parameters(const arguments& args) ;
// Obtain associated data and functions
//
virtual data* provide_data() const ;
virtual function* provide_function() const ;
protected: // function
// 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 vertical_segment* dat, int np, int nq, int ny, rational_function_1d* fit) ;
protected: // data
......
......@@ -129,12 +129,15 @@ void rational_function_chebychev::save_matlab(const std::string& filename, const
file << "\tp(" << j+1 << ",:) = ";
for(unsigned int i=0; i<np; ++i)
{
if(i > 0 && a[np*j + i] >= 0.0)
if(i > 0 && a[i] >= 0.0)
{
file << " + ";
else if(a[np*j + i] < 0.0)
}
else if(a[i] < 0.0)
{
file << " " ;
file << a[np*j + i];
}
file << a[i];
std::vector<int> degree = rf->index2degree(i);
for(unsigned int k=0; k<degree.size(); ++k)
......@@ -149,12 +152,15 @@ void rational_function_chebychev::save_matlab(const std::string& filename, const
file << "\tq(" << j+1 << ",:) = ";
for(unsigned int i=0; i<nq; ++i)
{
if(i > 0 && b[np*j + i] >= 0.0)
if(i > 0 && b[i] >= 0.0)
{
file << " + ";
else if(b[np*j + i] < 0.0)
}
else if(b[i] < 0.0)
{
file << " " ;
file << b[np*j + i] ;
}
file << b[i] ;
std::vector<int> degree = rf->index2degree(i);
for(unsigned int k=0; k<degree.size(); ++k)
......@@ -230,11 +236,15 @@ void rational_function_chebychev::save_cpp(const std::string& filename, const ar
file << "\tp = ";
for(unsigned int i=0; i<np; ++i)
{
if(i > 0 && a[np*j + i] >= 0.0)
if(i > 0 && a[i] >= 0.0)
{
file << " + ";
}
file << a[np*j + i];
else if(a[i] < 0.0)
{
file << " " ;
}
file << a[i];
std::vector<int> degree = rf->index2degree(i);
for(unsigned int k=0; k<degree.size(); ++k)
......@@ -248,12 +258,15 @@ void rational_function_chebychev::save_cpp(const std::string& filename, const ar
file << "\tq = ";
for(unsigned int i=0; i<nq; ++i)
{
if(i > 0 && b[np*j + i] >= 0.0)
if(i > 0 && b[i] >= 0.0)
{
file << " + ";
else if(b[np*j + i] < 0.0)
}
else if(b[i] < 0.0)
{
file << " " ;
file << b[np*j + i] ;
}
file << b[i] ;
std::vector<int> degree = rf->index2degree(i);
for(unsigned int k=0; k<degree.size(); ++k)
......@@ -300,7 +313,7 @@ void rational_function_chebychev::save(const std::string& filename) const
{
file << index[j] << "\t" ;
}
file << a[i+np*k] << std::endl ;
file << a[i] << std::endl ;
}
for(unsigned int i=0; i<nq; ++i)
......@@ -310,12 +323,8 @@ void rational_function_chebychev::save(const std::string& filename) const
{
file << index[j] << "\t" ;
}
file << b[i+nq*k] << std::endl ;
file << b[i] << std::endl ;
}
}
}
//Q_EXPORT_PLUGIN2(rational_function_chebychev, rational_function_chebychev)
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