POV-Ray : Newsgroups : povray.general : spherical light math help ... : Re: spherical light math help ... Server Time
10 Aug 2024 11:23:37 EDT (-0400)
  Re: spherical light math help ...  
From: Paul Vanukoff
Date: 7 Jan 2000 17:57:28
Message: <38766f58@news.povray.org>
Now why didn't I think of that .. it's so simple, it just might work! :)
Thanks!

--
Paul Vanukoff
van### [at] primenetcom


Chris Huff wrote in message ...
>In article <3876546f@news.povray.org>, <msk### [at] msncom> wrote:
>
>> Another method... if you can deal with a slight increase in parse time.
>> Take the code you have and copy it so it appears twice in a
>> row.  Then take the first occurance and change it like this (I commented
>> the "ADDED" lines to show which ones they were):
>>
>> #declare STEP=0.2;
>>
>> #declare NumLights = 0;  // ADDED
>>
>> #declare M=-1;
>> #while (M<=1)
>>     #declare N=-1;
>>     #while (N<=1)
>>         #declare O=-1;
>>         #while (O<=1)
>>             #declare NumLights  = NumLights + 1; // ADDED
>>             #declare O=O+STEP;
>>         #end
>>     #declare N=N+STEP;
>>     #end
>> #declare M=M+STEP;
>> #end
>>
>> Then you can divide by NumLights.  Just make sure STEP is the same in
>> both sets of loops.
>
>That won't work, you have to increment NumLights only for those
>positions inside the sphere:
>
>#declare M=-1;
>#while (M<=1)
>    #declare N=-1;
>    #while (N<=1)
>        #declare O=-1;
>        #while (O<=1)
>            #if (vlength(<M,N,O>) <= 1 )
>                #declare NumLights  = NumLights + 1;
>            #end
>            #declare O=O+STEP;
>        #end
>        #declare N=N+STEP;
>    #end
>    #declare M=M+STEP;
>#end
>
>Then you can use NumLights as the divider in the loop that places the
>lights.
>
>--
>Chris Huff
>e-mail: chr### [at] yahoocom
>Web page: http://chrishuff.dhs.org/


Post a reply to this message

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