Commit 7c6e2471 authored by Laurent Belcour's avatar Laurent Belcour

Adding 3D proj phi parametrization

parent 79d68114
......@@ -29,6 +29,7 @@ std::map<params::input, const param_info> create_map()
_map.insert(std::make_pair<params::input, const param_info>(params::ISOTROPIC_TV_TL_DPHI, param_info("ISOTROPIC_TV_TL_DPHI", 3, "Isotropic Light/View angle parametrization")));
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_VH, param_info("RUSIN_VH", 3, "Vector representation of the Half angle only")));
_map.insert(std::make_pair<params::input, const param_info>(params::SCHLICK_VK, param_info("SCHLICK_VH", 3, "Vector representation of the Back angle only")));
_map.insert(std::make_pair<params::input, const param_info>(params::ISOTROPIC_TL_TV_PROJ_DPHI, param_info("ISOTROPIC_TL_TV_PROJ_DPHI", 3, "Isoptropic projected phi parametrization.")));
/* 4D Params */
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_TH_PH_TD_PD, param_info("RUSIN_TH_PH_TD_PD", 4, "Complete Half angle parametrization")));
......@@ -93,12 +94,12 @@ 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[0] = invec[0]/theta*sin(theta);
outvec[1] = invec[1]/theta*sin(theta);
outvec[2] = cos(theta);
outvec[3] = 0.0;
outvec[4] = 0.0;
outvec[5] = 1.0;
outvec[3] = invec[0]/theta*sin(theta);
outvec[4] = invec[1]/theta*sin(theta);
outvec[5] = cos(theta);
outvec[0] = 0.0;
outvec[1] = 0.0;
outvec[2] = 1.0;
}
break;
......@@ -119,7 +120,7 @@ void params::to_cartesian(const double* invec, params::input intype,
half_to_cartesian(acos(invec[2]), atan2(invec[1], invec[0]), 0.0, 0.0, outvec);
break;
// \todo I should handle the phi_k in the conversion to CARTESIAN
case params::SCHLICK_VK:
case params::SCHLICK_VK:
outvec[0] = invec[2]*invec[2]-1.0;
outvec[1] = 0.0;
outvec[2] = invec[2];
......@@ -127,6 +128,17 @@ void params::to_cartesian(const double* invec, params::input intype,
outvec[4] = 0.0;
outvec[5] = invec[2];
break;
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);
outvec[5] = cos(theta);
outvec[0] = 0.0;
outvec[1] = 0.0;
outvec[2] = cos(invec[0]);
}
break;
// 4D Parametrization
case params::RUSIN_TH_PH_TD_PD:
......@@ -217,7 +229,7 @@ void params::from_cartesian(const double* invec, params::input outtype,
break;
case ISOTROPIC_TV_PROJ_DPHI:
{
const double theta = acos(invec[2]);
const double theta = acos(invec[5]);
const double dphi = atan2(invec[1], invec[0]) - atan2(invec[4], invec[3]);
outvec[0] = theta * cos(dphi);
outvec[1] = theta * sin(dphi);
......@@ -275,6 +287,16 @@ void params::from_cartesian(const double* invec, params::input outtype,
}
}
break;
case ISOTROPIC_TL_TV_PROJ_DPHI:
{
const double theta_l = acos(invec[2]);
const double theta_v = acos(invec[5]);
const double dphi = atan2(invec[1], invec[0]) - atan2(invec[4], invec[3]);
outvec[0] = theta_l;
outvec[1] = theta_v * cos(dphi);
outvec[2] = theta_v * sin(dphi);
}
break;
// 4D Parametrization
case params::RUSIN_TH_PH_TD_PD:
......
......@@ -62,6 +62,9 @@ class params
ISOTROPIC_TV_PROJ_DPHI,/*!< 2D Parametrization where the phi component is projected.
Coordinates are: [\f$\theta_v \cos(\Delta\phi), \theta_v
\sin(\Delta\phi).\f$]*/
ISOTROPIC_TL_TV_PROJ_DPHI,/*!< 3D Parametrization where the phi component is projected.
Coordinates are: [\f$\theta_l, \theta_v \cos(\Delta\phi),
\theta_v \sin(\Delta\phi).\f$]*/
ISOTROPIC_TD_PD, /*!< Difference between two directions such as R and H */
CARTESIAN, /*!< Light and View vectors represented in cartesian coordinates */
......
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