|
![](/i/fill.gif) |
Hi there, I'm having a little problem with #while loops. Here is the
situation, I have a sphere that I wante to "etch" by using difference with
a torus. I had this bright idea that instead of hand coding 6 toruses, I
could use a while loop to make them for me:
//Includes:
#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"
#include "metals.inc"
//Camera
camera {
right <-1.33,0,0>
up <0,10>
direction <0,0,1>
location <0,0,20>
look_at <0,0,0>
}
//Lights
light_source {<-20,35,34>
color {White}
}
light_source {<10,10,24>
color {White}
}
//White Background :)
background {White}
//And now the while loop
#declare Count1=0;
#while (Count1 < 6)
//This is the torus I want to make 6 (well 5 copies of)
#declare spinner2 =
torus { 1.0, 0.8
scale <1,0.1,1>
translate <0,0,0.5>
texture {T13} // A nice gold texture in metals.inc
}
difference {
//the sphere I want to "etch"
sphere {<0,0,0.5> 1.4
texture {T13}
object {spinner2 rotate <0,0,60*Count1>}
#declare Count1=Count1+1;
#end
Now my problem is, this doesn't seem to produce the effect I want, that is
a sphere, with a sort of star like pattern etched out. This drives me
nuts, becuase if I remove the difference, and the sphere from inside the
while loop, the six toruses are produced in the pattern I want, but I
can't for the life of me get it to subtract it from that sphere. So the
question I have is, is there a way for me to somehow #declare the while
loop created object? so I can THEN subtract that from the sphere? I tried
to #declare inside the while the loop, but seems to declare one instance
of the loop, not all of them (I hope I'm being clear, I'm not a programmer
:). Anyhow any help is appreciated, I hope my code doesn't have any typos
in it, since I typed in by hand hehe.
Leif Petersen
yf6### [at] victoria tc ca
Post a reply to this message
|
![](/i/fill.gif) |