Commit 8e456d84 authored by Laurent Belcour's avatar Laurent Belcour

Allow to export linear error showing all the samples.

parent 172ea03c
......@@ -54,11 +54,17 @@ int main(int argc, char** argv)
}
bool plot_error = false ;
bool linear_plot = false;
if(args.is_defined("error"))
{
std::cout << "<<INFO>> Exporting an error plot" << std::endl;
plot_error = true ;
}
else if(args.is_defined("linear_error"))
{
std::cout << "<<INFO>> Exporting linear error plot" << std::endl;
linear_plot = true;
}
// Load the BRDF
f->load(args["input"]);
......@@ -73,15 +79,29 @@ int main(int argc, char** argv)
vec v = d->get(i) ;
vec y2 = f->value(v) ;
for(int u=0; u<d->dimX(); ++u)
file << v[u] << "\t" ;
if(linear_plot)
{
for(int u=0; u<d->dimX(); ++u)
file << v[u] << "\t" ;
}
else
{
file << i << "\t" ;
}
for(int u=0; u<d->dimY(); ++u)
{
if(plot_error) {
file << y2[u] << "\t" ;
} else {
file << (v[d->dimX() + u] - y2[u])/v[d->dimX()+u] << "\t" ;
if(plot_error)
{
file << (v[d->dimX() + u] - y2[u])/v[d->dimX()+u] << "\t" ;
}
else if(linear_plot)
{
file << (v[d->dimX() + u] - y2[u])/v[d->dimX()+u] << "\t" ;
}
else
{
file << y2[u] << "\t" ;
}
}
......
......@@ -67,7 +67,9 @@ int main(int argc, char** argv)
file << phi << "\t" << theta << "\t" ;
for(int u=0; u<d->dimY(); ++u)
{
file << v[u] << "\t" ;
}
file << std::endl ;
}
......
......@@ -107,9 +107,9 @@ int main(int argc, char** argv)
}
file.close();
//*/
std::string error_filename = args["output"].substr(0,n);
error_filename.append(".errorplot") ;
std::ofstream efile(error_filename.c_str(), std::ios_base::trunc);
std::string error_filename = args["output"].substr(0,n);
error_filename.append(".errorplot") ;
file.open(error_filename.c_str(), std::ios_base::trunc);
for(int i=0; i<d->size(); ++i)
{
vec v = d->get(i) ;
......@@ -118,13 +118,33 @@ int main(int argc, char** argv)
vec y2 = f->value(v) ;
for(int u=0; u<d->dimX(); ++u)
efile << v[u] << "\t" ;
file << v[u] << "\t" ;
for(int u=0; u<d->dimY(); ++u)
efile << y2[u]-y1[u] << "\t" ;
file << y2[u]-y1[u] << "\t" ;
efile << std::endl ;
file << std::endl ;
}
file.close();
std::string linerror_filename = args["output"].substr(0,n);
linerror_filename.append(".linearerrorplot") ;
file.open(linerror_filename.c_str(), std::ios_base::trunc);
for(int i=0; i<d->size(); ++i)
{
vec v = d->get(i) ;
vec y1(d->dimY()) ;
for(int k=0; k<d->dimY(); ++k) { y1[k] = 0.5*(v[d->dimX() + k] +v[d->dimX()+d->dimY() + k]); }
vec y2 = f->value(v) ;
file << i << "\t" ;
for(int u=0; u<d->dimY(); ++u)
file << y2[u]-y1[u] << "\t" ;
file << std::endl ;
}
file.close();
//*/
#endif
}
......
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