Commit 48f94cf3 authored by Laurent Belcour's avatar Laurent Belcour
Browse files

Fixing a bug in the transformation of projected parametrizations (*_PROJ_DPHI).

Added print of the available params in the data2data soft.
parent 0c9e8b92
...@@ -115,18 +115,18 @@ void params::to_cartesian(const double* invec, params::input intype, ...@@ -115,18 +115,18 @@ void params::to_cartesian(const double* invec, params::input intype,
const double theta = sqrt(invec[0]*invec[0] + invec[1]*invec[1]); const double theta = sqrt(invec[0]*invec[0] + invec[1]*invec[1]);
if(theta > 0.0) if(theta > 0.0)
{ {
outvec[3] = (invec[0]/theta)*sin(theta); outvec[0] = (invec[0]/theta)*sin(theta);
outvec[4] = (invec[1]/theta)*sin(theta); outvec[1] = (invec[1]/theta)*sin(theta);
} }
else else
{ {
outvec[3] = 0.0; outvec[0] = 0.0;
outvec[4] = 0.0; outvec[1] = 0.0;
} }
outvec[5] = cos(theta); outvec[2] = cos(theta);
outvec[0] = 0.0; outvec[3] = 0.0;
outvec[1] = 0.0; outvec[4] = 0.0;
outvec[2] = 1.0; outvec[5] = 1.0;
} }
break; break;
...@@ -158,16 +158,16 @@ void params::to_cartesian(const double* invec, params::input intype, ...@@ -158,16 +158,16 @@ void params::to_cartesian(const double* invec, params::input intype,
case ISOTROPIC_TL_TV_PROJ_DPHI: case ISOTROPIC_TL_TV_PROJ_DPHI:
{ {
const double theta = sqrt(invec[1]*invec[1] + invec[2]*invec[2]); const double theta = sqrt(invec[1]*invec[1] + invec[2]*invec[2]);
if(theta > 0.0) // if(theta > 0.0)
{ // {
outvec[0] = (invec[1]/theta)*sin(theta); outvec[0] = (invec[1]/theta)*sin(theta);
outvec[1] = (invec[2]/theta)*sin(theta); outvec[1] = (invec[2]/theta)*sin(theta);
} // }
else // else
{ // {
outvec[0] = 0.0; // outvec[0] = sin(theta);
outvec[1] = 0.0; // outvec[1] = 0.0;
} // }
outvec[2] = cos(theta); outvec[2] = cos(theta);
outvec[3] = sin(invec[0]); outvec[3] = sin(invec[0]);
outvec[4] = 0.0; outvec[4] = 0.0;
...@@ -306,7 +306,7 @@ void params::from_cartesian(const double* invec, params::input outtype, ...@@ -306,7 +306,7 @@ void params::from_cartesian(const double* invec, params::input outtype,
break; break;
case ISOTROPIC_TV_PROJ_DPHI: case ISOTROPIC_TV_PROJ_DPHI:
{ {
const double theta = acos(invec[5]); const double theta = acos(invec[2]);
const double dphi = atan2(invec[1], invec[0]) - atan2(invec[4], invec[3]); const double dphi = atan2(invec[1], invec[0]) - atan2(invec[4], invec[3]);
outvec[0] = theta * cos(dphi); outvec[0] = theta * cos(dphi);
outvec[1] = theta * sin(dphi); outvec[1] = theta * sin(dphi);
......
...@@ -71,6 +71,10 @@ int main(int argc, char** argv) ...@@ -71,6 +71,10 @@ int main(int argc, char** argv)
std::cout << " parametrizations." << std::endl ; std::cout << " parametrizations." << std::endl ;
std::cout << " --data-correct-cosine Divide the value of the data points by the product of" << std::endl; std::cout << " --data-correct-cosine Divide the value of the data points by the product of" << std::endl;
std::cout << " the light and view vector dot product with the normal." << std::endl ; std::cout << " the light and view vector dot product with the normal." << std::endl ;
std::cout << std::endl;
std::cout << "Helps:" << std::endl;
std::cout << " --help Display this help." << std::endl;
std::cout << " --help-params Display the available input parametrizations." << std::endl;
return 0 ; return 0 ;
} }
if(args.is_defined("help-params")) { if(args.is_defined("help-params")) {
......
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