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:10:46 EDT (-0400)
  Re: cones.cpp: A typo and a question.  
From: Le Forgeron
Date: 14 Oct 2002 09:03:04
Message: <3DAAC08C.3000600@free.fr>
Massimo Valentini wrote:

> "Massimo Valentini" ha scritto
> : : 
> : : <CODE src=cones.cpp lines=206-213>
> : : a = D[X] * D[X] + D[Y] * D[Y];
> : : 
> : : if (a > EPSILON)
> : : {
> : 
> : 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. 
> : 
> 
> It seems to be worth the effort, I patched the function intersect_cone 
> in order to avoid the normalization of the ray direction and with some 
> simple tests, based on scenes constituted mostly by cylinders, this 
> patch saves a tenth of the total time and the image is the same produced 
> by the original povray. 
> 
> Comments, hints and counter-examples are appreciated.


NO MORE INLINE here please (even binary... ).

I made also some tests based on 3.1 sources (I'm not yet ready for 3.5) 
and get also a feeling of speed, but I forgot that I updated my compiler 
in the meantime, so the result are meaningless (until I revert to the 
old code and compile again...)

Mathematically, the correction is ok.
correcting the EPSILON factor is IMHO useless, just keep it "(a>EPSILON)".


Post a reply to this message

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