POV-Ray : Newsgroups : povray.general : how to prevent overlapping random objects? : Re: how to prevent overlapping random objects? Server Time
30 Jul 2024 04:23:33 EDT (-0400)
  Re: how to prevent overlapping random objects?  
From: stbenge
Date: 21 Aug 2010 20:28:00
Message: <4c706f10$1@news.povray.org>
Alain wrote:

>> Yeah, it's really horrible. POV's SDL wasn't meant to be quick at
>> everything...
>>
>> So far, my C++ implementation is very fast, for not being coded with ASM
>> and all. I was able to implement a few speedups, like not using
>> sqrt(x*x+y*y) for *every pixel*, but instead making a 1/4 circle 2D
>> array and picking from that.
> 
> What's the fastest? sqrt(x*x+y*y) or sqrt(x^2+y^2)
> In POV-Ray SDL, the second, as sqrt(pow(x,2)+pow(y,2)), is faster. Don't 
> know how it compare in C/C++ or other compiled languages.
> 
> May be worth testing.
> 
> Alain

Hmm, I was not aware that pow(n,2) was faster than n*n. I'll keep it in 
mind next time the issue comes up. In my program, sqrt(x*x+y*y) is only 
called at the very beginning to fill a small array.


Post a reply to this message

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