Commit 6ddcbd54 authored by Laurent Belcour's avatar Laurent Belcour

Correction of the param with an unitary test

parent 1a47c706
......@@ -94,8 +94,16 @@ void params::to_cartesian(const double* invec, params::input intype,
case ISOTROPIC_TV_PROJ_DPHI:
{
const double theta = 0.5*sqrt(invec[0]*invec[0] + invec[1]*invec[1]);
outvec[3] = invec[0]/theta*sin(theta);
outvec[4] = invec[1]/theta*sin(theta);
if(theta > 0.0)
{
outvec[3] = invec[0]/theta*sin(theta);
outvec[4] = invec[1]/theta*sin(theta);
}
else
{
outvec[3] = 0.0;
outvec[4] = 0.0;
}
outvec[5] = cos(theta);
outvec[0] = 0.0;
outvec[1] = 0.0;
......@@ -131,10 +139,18 @@ void params::to_cartesian(const double* invec, params::input intype,
case ISOTROPIC_TL_TV_PROJ_DPHI:
{
const double theta = 0.5*sqrt(invec[1]*invec[1] + invec[2]*invec[2]);
outvec[3] = invec[1]/theta*sin(theta);
outvec[4] = invec[2]/theta*sin(theta);
if(theta > 0.0)
{
outvec[3] = invec[1]/theta*sin(theta);
outvec[4] = invec[2]/theta*sin(theta);
}
else
{
outvec[3] = 0.0;
outvec[4] = 0.0;
}
outvec[5] = cos(theta);
outvec[0] = 0.0;
outvec[0] = sin(invec[0]);
outvec[1] = 0.0;
outvec[2] = cos(invec[0]);
}
......@@ -358,6 +374,7 @@ params::input params::parse_input(const std::string& txt)
{
if(txt.compare(it->second.name) == 0)
{
std::cout << "<<INFO>> parsed input parametrization " << it->second.name << std::endl;
return it->first;
}
}
......
import math
import random
f = open('unitary_extra_dim_2.input', 'w+')
# Generate the header of the file in the ALTA format
f.write("#DIM 2 1\n")
f.write("#PARAM_IN UNKNOWN\n")
f.write("#PARAM_OUT INV_STERADIAN\n")
nx = 100
ny = 100
for i in range(0,nx):
for j in range(0,ny):
x = i * 1.0/float(nx)
y = j * 1.0/float(ny)
val = math.sin(2*3.14*y) * math.pow(y-0.5, 4) ;
f.write(str(x) + '\t' + str(y) + '\t' + str(val) + '\n');
#end
#end
#end
f = open('unitary_extra_dim_1.input', 'w+')
# Generate the header of the file in the ALTA format
f.write("#DIM 1 1\n")
f.write("#PARAM_IN UNKNOWN\n")
f.write("#PARAM_OUT INV_STERADIAN\n")
nx = 100
ny = 100
for i in range(0,nx):
for j in range(0,ny):
y = j * 1.0/float(ny)
val = math.sin(2*3.14*y) * math.pow(y-0.5, 4) ;
f.write(str(y) + '\t' + str(val) + '\n');
#end
#end
#end
import math
f = open('unitary-proj-params-2d.data', 'w+')
# Generate the header of the file in the ALTA format
f.write("#DIM 2 1\n")
f.write("#PARAM_IN ISOTROPIC_TV_PROJ_DPHI\n")
f.write("#PARAM_OUT INV_STERADIAN\n")
def blinn(cost, sigma):
return math.pow(cost, sigma);
#endif
N = 100
for i in range(0,N):
for j in range(0,N):
x = math.pi*(i / float(N) - 0.5)
y = math.pi*(j / float(N) - 0.5)
theta = math.sqrt(x*x + y*y)
val = blinn(math.cos(theta), 10);
f.write(str(x) + '\t' + str(y) + '\t' + str(val) + "\n");
#end
#end
f = open('unitary-proj-params-3d.data', 'w+')
# Generate the header of the file in the ALTA format
f.write("#DIM 3 1\n")
f.write("#PARAM_IN ISOTROPIC_TL_TV_PROJ_DPHI\n")
f.write("#PARAM_OUT INV_STERADIAN\n")
def blinn(cost, sigma):
return math.pow(cost, sigma);
#endif
N = 100
M = 3
for t in range(0,M-1):
theta_i = 0.5 * math.pi * (t / float(M));
for i in range(0,N):
for j in range(0,N):
x = math.pi*(i / float(N) - 0.5)
y = math.pi*(j / float(N) - 0.5)
theta = math.sqrt(x*x + y*y)
dphi = math.atan2(y, x)
cos = math.cos(theta_i)*math.cos(theta) - math.sin(theta_i)*math.sin(theta)*math.cos(dphi)
if cos < 0.0:
cos = 0.0
val = blinn(cos, 10);
f.write(str(theta_i) + '\t' + str(x) + '\t' + str(y) + '\t' + str(val) + "\n");
#end
#end
#end
......@@ -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_isotropic_brdfcc_rescaled_alta.dat" />
<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_blinn.brdf" />
<!-- Define the function to use -->
......@@ -36,7 +36,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_isotropic_brdfcc_rescaled_alta.dat" />
<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_blinn.brdf" />
<!-- Define the function to use -->
......@@ -63,7 +63,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_isotropic_brdfcc_rescaled_alta.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" />
</action>
......@@ -73,7 +73,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_isotropic_brdfcc_rescaled_alta.dat" />
<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_sg.brdf" />
<!-- Define the function to use -->
......@@ -98,7 +98,7 @@
<input name="./results/3d/retro/3M_jaune_sg.brdf" />
<output name="./results/3d/retro/3M_jaune_sg.dat" />
<parameter name="data" value="../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_isotropic_brdfcc_rescaled_alta.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" />
</action>
......@@ -107,7 +107,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_isotropic_brdfcc_rescaled_alta.dat" />
<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_lafortune.brdf" />
<!-- Define the function to use -->
......@@ -139,7 +139,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_isotropic_brdfcc_rescaled_alta.dat" />
<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_backbeckmann.brdf" />
<!-- Define the function to use -->
......@@ -158,7 +158,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_isotropic_brdfcc_rescaled_alta.dat" />
<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_retrobeckmann.brdf" />
<!-- Define the function to use -->
......
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