POV-Ray : Newsgroups : povray.general : how to prevent overlapping random objects? : Re: how to prevent overlapping random objects? Server Time
30 Jul 2024 04:16:04 EDT (-0400)
  Re: how to prevent overlapping random objects?  
From: stbenge
Date: 21 Aug 2010 20:25:49
Message: <4c706e8d$1@news.povray.org>
Slime wrote:
>> 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.
> 
> You're doing a radius comparison, right? You probably don't need to take 
> a square root.

No, I'm setting specific radii (in pixels) and testing against a 2D 
array using a brute-force method. In POV I was doing radius comparisons. 
At any rate, I'm only having to do the sqrt(x*x+y*y) calculation 128*128 
times when the program starts, to fill an array. It's like 1/4 of a 
cylindrical pigment, and is the maximum circle radius. It's a drop in 
the bucket, really.

Of course, with today's computers I can afford to be so wasteful. Not 
that my program is running at record speeds or anything. Maybe if I knew 
assembly language... :(


Post a reply to this message

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