Commit b5091114 authored by pacanows's avatar pacanows

Merge

parents 295c7e51 587aa3ea
......@@ -144,7 +144,7 @@ double function::L2_distance(const data* d) const
for(int i=0; i<d->size(); ++i)
{
vec dat = d->get(i);
vec x(dimX()), y(d->dimY());
vec x(dimX()), y(dimY());
if(input_parametrization() == params::UNKNOWN_INPUT)
{
......@@ -165,13 +165,14 @@ double function::L2_distance(const data* d) const
//! \brief Linf norm to data.
double function::Linf_distance(const data* d) const
{
vec mean(dimY()), var(dimY());
vec mean = vec::Zero(dimY());
vec var = vec::Zero(dimY());
double linf_dist = 0.0;
for(int i=0; i<d->size(); ++i)
{
vec dat = d->get(i);
vec x(dimX()), y(d->dimY());
vec x(dimX()), y(dimY());
if(input_parametrization() == params::UNKNOWN_INPUT)
{
......
......@@ -18,6 +18,8 @@ std::map<params::input, const param_info> create_map()
/* 1D Params */
_map.insert(std::make_pair<params::input, const param_info>(params::COS_TH, param_info("COS_TH", 1, "Cosine of the Half angle")));
_map.insert(std::make_pair<params::input, const param_info>(params::COS_TK, param_info("COS_TK", 1, "Cosine of the Back angle")));
_map.insert(std::make_pair<params::input, const param_info>(params::COS_TLV, param_info("COS_TLV", 1, "Cosine of the Light and View directions")));
_map.insert(std::make_pair<params::input, const param_info>(params::COS_TLR, param_info("COS_TLR", 1, "Cosine of the Light and Reflected directions")));
/* 2D Params */
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_TH_TD, param_info("RUSIN_TH_TD", 2, "Radialy symmetric Half angle parametrization")));
......@@ -82,6 +84,22 @@ void params::to_cartesian(const double* invec, params::input intype,
outvec[4] = 0.0;
outvec[5] = invec[0];
break;
case params::COS_TLV:
outvec[0] = sqrt(1.0 - invec[0]*invec[0]);
outvec[1] = 0.0;
outvec[2] = invec[0];
outvec[3] = 0.0;
outvec[4] = 0.0;
outvec[5] = 1.0;
break;
case params::COS_TLR:
outvec[0] = - sqrt(1.0 - invec[0]*invec[0]);
outvec[1] = 0.0;
outvec[2] = invec[0];
outvec[3] = 0.0;
outvec[4] = 0.0;
outvec[5] = 1.0;
break;
// 2D Parametrizations
case params::COS_TH_TD:
......@@ -232,6 +250,12 @@ void params::from_cartesian(const double* invec, params::input outtype,
outvec[0] = (invec[2] + invec[5]) / sqrt(Kx*Kx + Ky*Ky + Kz*Kz);
}
break;
case params::COS_TLV:
outvec[0] = invec[0]*invec[3] + invec[1]*invec[4] + invec[2]*invec[5];
break;
case params::COS_TLR:
outvec[0] = invec[0]*invec[3] - (invec[1]*invec[4] + invec[2]*invec[5]);
break;
// 2D Parametrizations
case params::COS_TH_TD:
......
......@@ -57,6 +57,8 @@ class params
STEREOGRAPHIC, /*!< Stereographic projection of the Light and View vectors */
SPHERICAL_TL_PL_TV_PV, /*!< Light and View vectors represented in spherical coordinates */
COS_TLV, /*!< Dot product between the Light and View vector */
COS_TLR, /*!< Dot product between the Light and Reflected vector */
ISOTROPIC_TV_TL, /*!< Light and View vectors represented in spherical coordinates, */
ISOTROPIC_TV_TL_DPHI, /*!< Light and View vectors represented in spherical coordinates,
with the difference of azimutal coordinates in the last component */
......
......@@ -363,9 +363,15 @@ function* plugins_manager::get_function(const arguments& args)
}
nonlinear_function* func_fres = dynamic_cast<nonlinear_function*>(get_function(arguments::create_arguments(n)));
// func_fres->setBase(nl_func);
// return func_fres;
if(func_fres != NULL)
{
return new product_function(nl_func, func_fres);
}
else
{
std::cerr << "<<ERROR>> the right part of the product is not a nonlinear function. Will use only the left part." << std::endl;
return func;
}
}
......
......@@ -3,5 +3,5 @@ env.Append(CPPPATH = ['../../../external/build/include', '../../'])
env.Append(LIBPATH = ['../../../external/build/lib', '../../build'])
sources = ['fitter.cpp']
libs = ['-lceres', '-lglog', '-lgomp', '-lcore']
libs = ['-lceres', '-lglog', '-lgomp', '-lcore', '-llapack']
env.SharedLibrary('../../build/nonlinear_fitter_ceres', sources, LIBS=libs)
......@@ -18,7 +18,7 @@ SUBDIRS = \
nonlinear_fresnel_normalized_schlick \
nonlinear_fresnel_retroschlick \
nonlinear_function_diffuse \
nonlinear_function_microfacets \
# nonlinear_function_microfacets \
nonlinear_function_abc \
nonlinear_function_beckmann \
nonlinear_function_retrobeckmann \
......
<?xml version="1.0"?>
<alta>
<!-- This script file compute the fitting of the retro-reflecting materials present in
the ALTA library. This script file should be executed in the sources directory of
repository as all directories are relative.
<!-- This script file compute the fitting of the retro-reflecting materials
present in the ALTA library. This script file should be executed in
the sources directory of repository as all directories are relative.
It is also necessary to create a results/3d/retro directory to store the resulting
fits and exports to BRDF-explorer and matlab.
It is also necessary to create a results/3d/retro directory to store
the resulting fits and exports to BRDF-explorer and matlab.
-->
<configuration>
<parameter name="lib-dir" value="./build" />
......@@ -15,7 +15,7 @@
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_abc.brdf" />
<!-- Define the function to use -->
......@@ -29,12 +29,11 @@
<!-- Parameters -->
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 0, 2]" />
<parameter name="data-correct-cosine" value="" />
</action>
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_abc.brdf" />
<!-- Define the function to use -->
......@@ -51,13 +50,18 @@
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 0, 2]" />
<parameter name="bootstrap" value="./results/3d/retro/3M_jaune_abc.brdf" />
<parameter name="data-correct-cosine" value="" />
</action>
<!-- Fitting the lobe using a back parametrization:
The ABC model uses the dot product between the back and the
normal vectors.
-->
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<output name="./results/3d/retro/3M_jaune_abc.brdf" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_abc_back.brdf" />
<!-- Define the function to use -->
<function name="nonlinear_function_diffuse" />
......@@ -76,13 +80,12 @@
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 2, 2]" />
<parameter name="bootstrap" value="./results/3d/retro/3M_jaune_abc.brdf" />
<parameter name="data-correct-cosine" value="" />
</action>
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<output name="./results/3d/retro/3M_jaune_abc.brdf" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_abc_back.brdf" />
<!-- Define the function to use -->
<function name="nonlinear_function_diffuse" />
......@@ -101,22 +104,89 @@
<!-- Parameters -->
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 2, 2]" />
<parameter name="bootstrap" value="./results/3d/retro/3M_jaune_abc.brdf" />
<parameter name="data-correct-cosine" value="" />
<parameter name="bootstrap" value="./results/3d/retro/3M_jaune_abc_back.brdf" />
</action>
<!-- Export the fit -->
<action name="brdf2gnuplot">
<!-- Input and output arguments of the action -->
<input name="./results/3d/retro/3M_jaune_abc.brdf" />
<output name="./results/3d/retro/3M_jaune_abc.dat" />
<input name="./results/3d/retro/3M_jaune_abc_back.brdf" />
<output name="./results/3d/retro/3M_jaune_abc_back.dat" />
<parameter name="data" value="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<parameter name="data" value="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 2, 2]" />
</action>
<!-- Fitting the lobe using a retro parametrization:
The ABC model uses the dot product between the light and the
view vectors.
-->
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_abc_retro.brdf" />
<!-- Define the function to use -->
<function name="nonlinear_function_diffuse" />
<function name="nonlinear_function_abc">
<parameter name="fresnel" value="./build/libnonlinear_fresnel_schlick.so"/>
<!--<parameter name="fixed" value="" />-->
</function>
<function name="nonlinear_function_abc">
<parameter name="param" value="COS_TLV" />
</function>
<!-- Define the ftting procedure to use -->
<plugin type="fitter" name="nonlinear_fitter_ceres" />
<!-- Parameters -->
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 2, 2]" />
<parameter name="bootstrap" value="./results/3d/retro/3M_jaune_abc.brdf" />
</action>
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_abc_retro.brdf" />
<!-- Define the function to use -->
<function name="nonlinear_function_diffuse" />
<function name="nonlinear_function_abc">
<parameter name="fresnel" value="./build/libnonlinear_fresnel_schlick.so"/>
<!--<parameter name="fixed" value="" />-->
</function>
<function name="nonlinear_function_abc">
<parameter name="fresnel" value="./build/libnonlinear_fresnel_retroschlick.so"/>
<parameter name="param" value="COS_TLV" />
</function>
<!-- Define the ftting procedure to use -->
<plugin type="fitter" name="nonlinear_fitter_ceres" />
<!-- Parameters -->
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 2, 2]" />
<parameter name="bootstrap" value="./results/3d/retro/3M_jaune_abc_retro.brdf" />
</action>
<!-- Export the fit -->
<action name="brdf2gnuplot">
<!-- Input and output arguments of the action -->
<input name="./results/3d/retro/3M_jaune_abc_retro.brdf" />
<output name="./results/3d/retro/3M_jaune_abc_retro.dat" />
<parameter name="data" value="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 2, 2]" />
</action>
</alta>
......@@ -15,7 +15,7 @@
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_beck.brdf" />
<!-- Define the function to use -->
......@@ -34,7 +34,7 @@
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_beck.brdf" />
<!-- Define the function to use -->
......@@ -59,7 +59,7 @@
<input name="./results/3d/retro/3M_jaune_beck.brdf" />
<output name="./results/3d/retro/3M_jaune_beck.dat" />
<parameter name="data" value="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<parameter name="data" value="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 2, 2]" />
......@@ -67,7 +67,7 @@
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_beck.brdf" />
<!-- Define the function to use -->
......@@ -90,7 +90,7 @@
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_beck.brdf" />
<!-- Define the function to use -->
......@@ -119,7 +119,7 @@
<input name="./results/3d/retro/3M_jaune_beck.brdf" />
<output name="./results/3d/retro/3M_jaune_beck.dat" />
<parameter name="data" value="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<parameter name="data" value="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 2, 2]" />
......
......@@ -15,7 +15,7 @@
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_blinn.brdf" />
<!-- Define the function to use -->
......@@ -35,7 +35,7 @@
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_blinn.brdf" />
<!-- Define the function to use -->
......@@ -59,7 +59,7 @@
<action name="data2brdf">
<!-- Input and output arguments of the action -->
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<input name="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<output name="./results/3d/retro/3M_jaune_blinn.brdf" />
<!-- Define the function to use -->
......@@ -89,7 +89,7 @@
<input name="./results/3d/retro/3M_jaune_blinn.brdf" />
<output name="./results/3d/retro/3M_jaune_blinn.dat" />
<parameter name="data" value="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_162.alta" />
<parameter name="data" value="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_3D+3DS+3DR_BRDF_dense__nbsgrid_81.alta" />
<parameter name="min" value="[0.1, -2, -2]" />
<parameter name="max" value="[1.7, 2, 2]" />
......
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