POV-Ray : Newsgroups : povray.programming : Alternative Box Intersection Algorithm : Re: Alternative Box Intersection Algorithm Server Time
30 Jun 2024 12:35:59 EDT (-0400)
  Re: Alternative Box Intersection Algorithm  
From: Ryan Lamansky
Date: 14 Sep 2004 18:22:32
Message: <41476f28$1@news.povray.org>
>   Code simplicity is in no way a measurement of speed. (For example,
> insertion sort is much simpler than quicksort, yet it's also much
> slower.)

That's true, but in this case there simply isn't much work going on.  A 
few ifs, a few comparisons, and a few math operations.  There's really 
no way you can look at it and claim that it's slow :)

>   I'm not saying your code is not faster, I'm just saying that you
> should be careful on what you claim. :)

When I initially discovered this algorithm, I ran some tests on both the 
  alternative and the original in C#.  The alternative one was more than 
twice as fast in that environment.  Since the Intersect_Box function 
could be called millions of times in a render, I was hoping to see 
_some_ kind of improvement when converted to POV-Ray.

In spite of the mysterious absence of any performance difference, I 
still think it's "good" code because it's much simpler, and it's much 
more accurate since the EPSILON test is delayed until the very end.  A 
possible drawback is that IEEE floating point behavior is required--I 
don't have enough experience with the various POV-Ray-supported 
platforms to know if this is a problem.

-Ryan


Post a reply to this message

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