|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Mon, 15 Mar 1999 20:15:38 GMT, nos### [at] despamcom (Jerry Anning)
wrote:
>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 )
******** And here! ***********
>> #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
Jerry Anning
clem "at" dhol "dot" com
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Is it just me or did you not actually write anything in those two previous
posts? ;-)
--
Lance.
---
For the latest 3D Studio MAX plug-ins, images and much more, go to:
The Zone - http://come.to/the.zone
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
he added the same comment that I did.
--
//Spider
[ spi### [at] bahnhofse ]-[ http://www.bahnhof.se/~spider/ ]
What I can do and what I could do, I just don't know anymore
"Marian"
By: "Sisters Of Mercy"
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thank you. I figured it had to something obvious like that, I only couldn't admit
to it yesterday. Thank you.
I DID take programming courses at one point, granted it was a Modula-2 class, but
it was programming... that's what you forget over the years.
Spider wrote:
> // initalize the array
> #macro InitGrid ()
> #local i = 0;
> #while ( i < 10 )
> #local j = 0;
> //RESET J HERE !!!
> #while ( j < 10 )
> #declare MyGrid[i][j] = 1;
> #local j = j + 1;
> #end
> #local i = i + 1;
> #end
> #end
>
> #macro DrawGrid ()
> #local i = 0;
> #while (i < 10 )
> //RESET J HERE !!!
> #local j = 0;
> #while ( j < 10 )
> sphere { <i*2,2,j*2> MyGrid[i][j]
> pigment { red 1 }
> finish { phong 1 } }
> #local j = j + 1;
> #end
> #local i = i + 1;
> #end
> #end
>
>
> I set the comments. Sorry for screaming :-)
> you only have to reinit J to 0 every outer loop, or it will only happen ince.
> And, use #local inside a macro.
> --
> //Spider
> ( spi### [at] bahnhofse ) [ http://www.bahnhof.se/~spider/ ]
> #declare life = rand(seed(42))*sqrt(-1);
--
Josh English
eng### [at] spiritonecom
www.spiritone.com/~english
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I've been coding for years, and I still do that mistake sometimes...
--
//Spider
[ spi### [at] bahnhofse ]-[ http://www.bahnhof.se/~spider/ ]
What I can do and what I could do, I just don't know anymore
"Marian"
By: "Sisters Of Mercy"
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Okay, barring any stupid coding problems, here we go with an example. It will only to
two
dimentions right now and it not even complete there, but it provides a starting point:
#declare Max_X = 10; // number of spheres along X Axis
#declare Max_Z = 10; // number of spheres along Y Axis
#declare Base_Radius = 1; // radius of a sphere that is not under the influence
#declare Max_Radius = 2; // radius of the sphere that is under the influence
#declare Steps = 5; // the fifth sphere from the center of the effect will be at Base
Radius
#declare Each_Step = (Max_Radius - Base_Radius)/Steps; // Quick formula to determine
// how different adjacent spheres will be
#declare separation = 4; // the distance between sphere centers
#declare MyGrid = array[Max_X][Max_Z]
// initalize the array, giving everything a value of Base Radius
#macro InitGrid ()
#declare i = 0;
#while ( i < Max_X )
#declare j = 0;
#while ( j < Max_Z )
#declare MyGrid[i][j] = Base_Radius;
#declare j = j + 1;
#end
#declare i = i + 1;
#end
#end
#macro DrawGrid ()
#declare i = 0;
#while (i < Max_X )
#declare j = 0;
#while ( j < Max_Z )
sphere { <i*separation,2,j*separation> MyGrid[i][j] // Y value is merely
temporary
pigment { red 1 }
finish { phong 1 } }
#declare j = j + 1;
#end
#declare i = i + 1;
#end
#end
#macro CheckCord(a,b) // we will use this one extensively
( (a < Max_X) & (a >= 0) & (b < Max_Z ) & ( b >= 0 ) )
#end
#macro AlterGrid (m,n) // this macro changes the spheres in the gird
#declare MyGrid[m][n] = Max_Radius;
#declare cvar = 1;
#while (cvar < Steps )
#declare Temp_Radius = Max_Radius- (cvar * Each_Step );
#if (CheckCord(m + cvar, n) ) // spheres in the +X direction
#declare MyGrid[m+cvar][n] = Temp_Radius;
#end
#if (CheckCord(m-cvar, n) ) // spheres in the -X direction
#declare MyGrid[m-cvar][n] = Temp_Radius;
#end
#if (CheckCord(m, n+cvar) ) // spheres in the +Z direction
#declare MyGrid[m][n+cvar] = Temp_Radius;
#end
#if (CheckCord(m, n-cvar) ) // spheres in the -Z direction
#declare MyGrid[m][n-cvar] = Temp_Radius;
#end
#if ( CheckCord (m+cvar,n+cvar) ) // spheres in +X,+Z diagonal
#declare MyGrid[m+cvar][n+cvar] = Temp_Radius;
#end
#if ( CheckCord (m+cvar,n-cvar) ) // spheres in the +X,-Z direction
#declare MyGrid[m+cvar][n-cvar] = Temp_Radius;
#end
#if ( CheckCord (m-cvar,n+cvar) ) // spheres in -X,+Z direction
#declare MyGrid[m-cvar][n+cvar] = Temp_Radius;
#end
#if ( CheckCord (m-cvar,n-cvar) ) // spheres in the -X,-Z direction.
#declare MyGrid[m-cvar][n-cvar] = Temp_Radius;
#end
#declare cvar = cvar + 1;
#end
#end // AlterGrid
InitGrid()
AlterGrid (4,5)
DrawGrid()
Sadly, this still misses 24 cubes in the grid. I'm sure there's an easier way to do
it, and
this is mostly brute force, but it works.
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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thankyou all.
--
Andy
Josh English wrote in message <36E### [at] spiritonecom>...
>Okay, barring any stupid coding problems, here we go with an example. It will only to
two
>dimentions right now and it not even complete there, but it provides a starting
point:
>
>#declare Max_X = 10; // number of spheres along X Axis
>#declare Max_Z = 10; // number of spheres along Y Axis
>#declare Base_Radius = 1; // radius of a sphere that is not under the influence
>#declare Max_Radius = 2; // radius of the sphere that is under the influence
>#declare Steps = 5; // the fifth sphere from the center of the effect will be at Base
Radius
>
>#declare Each_Step = (Max_Radius - Base_Radius)/Steps; // Quick formula to determine
>
>// how different adjacent spheres will be
>#declare separation = 4; // the distance between sphere centers
>
>
>#declare MyGrid = array[Max_X][Max_Z]
>
>// initalize the array, giving everything a value of Base Radius
>#macro InitGrid ()
> #declare i = 0;
> #while ( i < Max_X )
> #declare j = 0;
> #while ( j < Max_Z )
> #declare MyGrid[i][j] = Base_Radius;
> #declare j = j + 1;
> #end
> #declare i = i + 1;
> #end
>#end
>
>
>#macro DrawGrid ()
> #declare i = 0;
> #while (i < Max_X )
> #declare j = 0;
> #while ( j < Max_Z )
> sphere { <i*separation,2,j*separation> MyGrid[i][j] // Y value is merely
temporary
> pigment { red 1 }
> finish { phong 1 } }
> #declare j = j + 1;
> #end
> #declare i = i + 1;
> #end
>#end
>
>#macro CheckCord(a,b) // we will use this one extensively
> ( (a < Max_X) & (a >= 0) & (b < Max_Z ) & ( b >= 0 ) )
>#end
>
>#macro AlterGrid (m,n) // this macro changes the spheres in the gird
> #declare MyGrid[m][n] = Max_Radius;
> #declare cvar = 1;
> #while (cvar < Steps )
>
> #declare Temp_Radius = Max_Radius- (cvar * Each_Step );
>
> #if (CheckCord(m + cvar, n) ) // spheres in the +X direction
> #declare MyGrid[m+cvar][n] = Temp_Radius;
> #end
>
> #if (CheckCord(m-cvar, n) ) // spheres in the -X direction
> #declare MyGrid[m-cvar][n] = Temp_Radius;
> #end
>
> #if (CheckCord(m, n+cvar) ) // spheres in the +Z direction
> #declare MyGrid[m][n+cvar] = Temp_Radius;
> #end
>
> #if (CheckCord(m, n-cvar) ) // spheres in the -Z direction
> #declare MyGrid[m][n-cvar] = Temp_Radius;
> #end
>
> #if ( CheckCord (m+cvar,n+cvar) ) // spheres in +X,+Z diagonal
> #declare MyGrid[m+cvar][n+cvar] = Temp_Radius;
> #end
>
> #if ( CheckCord (m+cvar,n-cvar) ) // spheres in the +X,-Z direction
> #declare MyGrid[m+cvar][n-cvar] = Temp_Radius;
> #end
>
> #if ( CheckCord (m-cvar,n+cvar) ) // spheres in -X,+Z direction
> #declare MyGrid[m-cvar][n+cvar] = Temp_Radius;
> #end
>
> #if ( CheckCord (m-cvar,n-cvar) ) // spheres in the -X,-Z direction.
> #declare MyGrid[m-cvar][n-cvar] = Temp_Radius;
> #end
>
> #declare cvar = cvar + 1;
> #end
>
>#end // AlterGrid
>
>
>InitGrid()
>
>AlterGrid (4,5)
>
>DrawGrid()
>
>Sadly, this still misses 24 cubes in the grid. I'm sure there's an easier way to do
it,
and
>this is mostly brute force, but it works.
>
>
>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
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
To reduce memory of the scene, declare a pigment for the spheres, and then call
that. This will reduce it grately if you have more advanced scenes.
Here's a test.
#declare N = 100000;
#while(N>0)
#declare N = N-1;
sphere {
<0,0,N>,.25
texture {
pigment {
hexagon
Red
Blue
Green
}
finish { ambient 1 }
}
}
#end
compared to
#declare T =
texture {
pigment {
hexagon
Red
Blue
Green
}
finish { ambient 1 }
}
#declare N = 100000;
#while(N>0)
#declare N = N-1;
sphere { <0,0,N>,.25 texture { T } }
#end
(sorry about the tabs)
--
//Spider
[ spi### [at] bahnhofse ]-[ http://www.bahnhof.se/~spider/ ]
What I can do and what I could do, I just don't know anymore
"Marian"
By: "Sisters Of Mercy"
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Wed, 17 Mar 1999 01:26:06 +0100, Spider <spi### [at] bahnhofse> wrote:
>To reduce memory of the scene, declare a pigment for the spheres, and then call
>that. This will reduce it grately if you have more advanced scenes.
>Here's a test.
That's only true for meshes. Each sphere still has a copy of the
entire texture.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Oh? Hmm, ok.
Ron Parker wrote:
>
> On Wed, 17 Mar 1999 01:26:06 +0100, Spider <spi### [at] bahnhofse> wrote:
> >To reduce memory of the scene, declare a pigment for the spheres, and then call
> >that. This will reduce it grately if you have more advanced scenes.
> >Here's a test.
>
> That's only true for meshes. Each sphere still has a copy of the
> entire texture.
--
//Spider
[ spi### [at] bahnhofse ]-[ http://www.bahnhof.se/~spider/ ]
What I can do and what I could do, I just don't know anymore
"Marian"
By: "Sisters Of Mercy"
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|