POV-Ray : Newsgroups : povray.programming : cones.cpp: A typo and a question. : Re: cones.cpp: A typo and a question. Server Time
28 Jul 2024 06:20:30 EDT (-0400)
  Re: cones.cpp: A typo and a question.  
From: Le Forgeron
Date: 8 Oct 2002 10:03:48
Message: <3DA2E5CE.4090906@free.fr>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.