Commit c163d25e authored by Laurent Belcour's avatar Laurent Belcour

Adding a parametrization convertion for the retro param

parent 11c1f144
......@@ -127,8 +127,8 @@ void timer::stop()
void timer::reset()
{
_elapsed = 0;
_start = 0;
_stop = 0;
_start = current_time();
_stop = _start;
}
int timer::elapsed() const
......@@ -157,11 +157,8 @@ unsigned int timer::current_time() const
SYSTEMTIME res;
GetSystemTime(&res);
return (unsigned int)(res.wSecond + res.wMinute*60 + res.wHour*360);
#elif __APPLE__
return static_cast<unsigned int>(clock() / CLOCKS_PER_SEC);
#else
struct timespec res;
clock_gettime(CLOCK_REALTIME, &res);
return static_cast<unsigned int>(res.tv_sec);
time_t _t = time(NULL);
return (unsigned int)_t;
#endif
}
......@@ -27,5 +27,4 @@ SOURCES = common.cpp \
vertical_segment.cpp \
rational_function.cpp \
params.cpp \
function.cpp \
# clustering.cpp
function.cpp
......@@ -178,7 +178,25 @@ void params::to_cartesian(const double* invec, params::input intype,
}
break;
case SCHLICK_TL_TK_PROJ_DPHI:
NOT_IMPLEMENTED();
{
// Set the light direction
outvec[3] = sin(invec[0]);
outvec[4] = 0.0;
outvec[5] = cos(invec[0]);
// The view direction is the symmetric of the reflected direction
// with respect to the back direction:
// v = 2 |r.k| k - r
// r = 2 |l.n| n - l = {-lx, -ly, lz }
const double theta = sqrt(invec[1]*invec[1] + invec[2]*invec[2]);
const double Kx = (theta > 0.0) ? (invec[1]/theta)*sin(theta) : 0.0;
const double Ky = (theta > 0.0) ? (invec[2]/theta)*sin(theta) : 0.0;
const double Kz = cos(theta);
const double dotKR = outvec[5]*Kz - outvec[3]*Kx;
outvec[0] = 2.0*dotKR*Kx + outvec[3];
outvec[1] = 2.0*dotKR*Ky;
outvec[2] = 2.0*dotKR*Kz - outvec[5];
}
break;
case RETRO_TL_TVL_PROJ_DPHI:
{
......
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