Commit 10fd7dd9 authored by Philipp Schäfer's avatar Philipp Schäfer
Browse files

Atmospheric Ray Tracing - Engine

-fixed bug in interpolation to reflection point
parent f58b48db
......@@ -33,11 +33,10 @@ class CWorker
void InterpolateToReflectionPoint(const VistaVector3D& r1, const VistaVector3D& r2, const double& dt, VistaVector3D& rReflection, double& dtReflection)
{
const VistaVector3D dr = r2 - r1;
const double timePortion = -r1[Vista::Z] / dr[Vista::Z];
const double portion = -r1[Vista::Z] / dr[Vista::Z];
rReflection = r1 + dr * dt;
rReflection[Vista::Z] = 0;
dtReflection = dt * timePortion;
rReflection = r1 + dr * portion;
dtReflection = dt * portion;
}
void ExtendRayByOnePeriod()
{
......@@ -95,6 +94,7 @@ class CWorker
VistaVector3D rGround;
double dtGround;
InterpolateToReflectionPoint(r, rNew, dt, rGround, dtGround);
rGround[Vista::Z] = 0; //Making sure z-component is truely zero
pRay->AppendReflection(rGround, n, time + dtGround);
if ( rAbortCriterion.AbortRequested(*pRay) )
......
Supports Markdown
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