|
![](/i/fill.gif) |
Massimo Valentini wrote:
> "Massimo Valentini" ha scritto
> This solution is not equivalent to the original code.
>
> This condition is different whether you scale the direction
> or not. May be there could be a way to avoid the square root (e.g.
> expressing this condition if (a > EPSILON*len^2)) but it'd require
> some work analyzing the code for both cones and cylinders.
>
The (a > EPSILON) is used to avoid numerical error (division by 0 and
alike, division by very small value gives a great inaccuracy)
EPSILON testing is also used later to avoid reflecting on the same
object forever
(First ray hit the object, then you compute a ray from the hit point...
if EPSILON is not used, due to numerical error, the new ray may find
again the same point [well, mathemacally, it is the same, but
numerically it may be a little different so that testing would not
detect it... hence the EPSILON : when the eye is near enough the
surface, the surface should be removed... Epsilon is an arbitrary value,
so using EPSILON or EPSILON*len^2 should not be of too much concern for
reasonnable value of len {ok, I might be contradicted by a scene...})
Sidenote: (a > EPSILON) and (t1 > EPSILON) show no correlation on the
value of EPSILON, so there is probably no problem at all!
> So you may either remove the condition for intersctions over
> Max_Distance, or shift the divisions t1,2/len before the test against
> Max_Distance.
>
Test against Max_distance is unrelated with Epsilon value, and is any
way a candidate for removal...
Post a reply to this message
|
![](/i/fill.gif) |