|
|
Matija nous illumina en ce 2009-02-15 06:49 -->
> Hi!
>
> I've been tryin to make somethign resembling an onion an cutting it away. Not
> that I want it to look as an onion, just a bunch of concentric spheres. I
> wanted to use the #while loop so that I wouldn't need to type much and could
> change stuff easily. But only the first iteration seems to run OK, then it gets
> weird. Could you please llok at my code, run it and help? Thanks!
>
> Matija
>
>
> #include "colors.inc"
> #include "glass.inc"
> #include "skies.inc"
> #include "textures.inc"
> background{White}
>
> camera {
> angle 15
> location <3,12,10>
> look_at <0,0,0>
> }
> light_source { <12, 5, 3> color White }
>
> #declare Stevec=1;
> #declare Rad1 = 1;
> #declare Rad2 = 0.1;
>
> #declare Onion =
>
> #while (Stevec >= 0.2)
> #declare Rad1=Stevec;
> #declare Rad2=Rad1-0.1;
> difference {
> sphere {<0,0,0>, Rad1}
> sphere {<0,0,0>, Rad2 hollow} cutaway_textures}
> #declare Stevec=Stevec-0.2;
>
> #end
>
> intersection {
> object {Onion pigment {color Green}}
> box {<0,-1,-1>
> <-1,1,1>
> pigment {color Blue}}
> }
>
>
Just une an union for your "Onion" object:
#declare Onion =
union{
#while (Stevec >= 0.2)
#declare Rad1=Stevec;
#declare Rad2=Rad1-0.1;
difference {
sphere {<0,0,0>, Rad1}
sphere {<0,0,0>, Rad2 }
}
#declare Stevec=Stevec-0.2;
#end
}
You don't need hollow as your objects are not intended to contain any media.
Anyway, hollow won't have any effect where it's used.
You don't need cutaway_textures either, as your object only have a single
texture that's applyed after it's deffined.
--
Alain
-------------------------------------------------
Rebellion against tyrants is obedience to God.
Benjamin Franklin
Post a reply to this message
|
|