POV-Ray : Newsgroups : povray.general : Math problem : Re: Math problem Server Time
12 Aug 2024 07:20:01 EDT (-0400)
  Re: Math problem  
From: Jerry Anning
Date: 15 Mar 1999 15:15:29
Message: <36ed6a32.9267778@news.povray.org>
On Mon, 15 Mar 1999 12:09:06 -0800, Josh English
<eng### [at] spiritonecom> wrote:

>Andrew Cocker wrote:
>
>> I hope someone can help get me started with my latest experiment.
>>
>> I want to try out arrays. My plan is to create a cube made up of, say, 20x20x20
tiny
>> spheres. If I pick one of these spheres and designate it to be the centre of the
effect
>> I'm trying to create, and scale it by a factor of 2, how do I make the surrounding
spheres
>> get gradually smaller until 5 spheres away they are back to scale 1? I plan to
animate the
>> effect so that the centre of the effect moves around inside the array of spheres.
>>
>> I have heard the term 'fields' used. Is this the method I should use, and if so,
could
>> anyone suggest either how it is done, or else point me in the direction of where I
can
>> find more out about it.
>>
>> I am not a mathematician or a programmer, but I hand-code only so I should be able
to make
>> use of any suggestions, as long as you assume large levels of ignorance on my part.
>>
>> Many thanks in anticipation.
>>
>> -----------
>> Andy
>
>I started a test file to look at this as follows:
>
>#declare MyGrid = array[10][10]
>
>// initalize the array
>#macro InitGrid ()
>  #declare i = 0;
>  #declare j = 0;
>
>  #while ( i < 10 )
******Insert #declare j=0; here! *********
>    #while ( j < 10 )
>      #declare MyGrid[i][j] = 1;
>      #declare j = j + 1;
>    #end
>    #declare i = i + 1;
>  #end
>#end
>
>
>#macro DrawGrid ()
>  #declare i = 0;
>  #declare j = 0;
>
>  #while (i < 10 )
>    #while ( j < 10 )
>      sphere { <i*2,2,j*2> MyGrid[i][j]
>               pigment { red 1 }
>               finish { phong 1 } }
>      #declare j = j + 1;
>    #end
>    #declare i = i + 1;
>  #end
>#end
>
>InitGrid()
>DrawGrid()
>
>And in theory this is place to start, but when I render this code I get 10 spheres
instead of
>100. It would appear that POV Ray does not like nested loops but there is nothing I
can find
>to support this theory... has anyone else run into this or am I missing somthing very
obvious
>in my code?
>--
>Josh English
>eng### [at] spiritonecom
>www.spiritone.com/~english
>
>

Jerry Anning
clem "at" dhol "dot" com


Post a reply to this message

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