|
|
I have a offset problem with object balls. With box, it's ok. If I change
the Wi and Hi, the box will remain in center but the balls wouldn't.
//Offset problems
global_settings { assumed_gamma 2.2 }
camera
{
location <0, 0, -20>
direction <0, 0, 1>
look_at <0, 0, 0>
}
light_source { <-10, 3, -20> color red 1 green 1 blue 1 }
sphere
{ <0, 0, 0>, 1
pigment {color rgbt <1, 1, 1, 0.5>}
}
#declare balls = union
{
#declare Hi=4;
#declare Wi=6;
#local CountX=0;
#declare OffsetY=-Hi/2; // Ouch...
#declare OffsetX=-2.5; //Wi=2:0.5, 3:1, 4:1.5, 5:2, 6:2.5
#while (CountX < Wi)
#local CountY=0;
#while (CountY < Hi)
sphere { <CountX, CountY, 0>, 0.25
pigment { color rgb <1, 1, 1>}
}
#local CountY=CountY+1;
#end
#local CountX=CountX+1;
#end
}
object {balls translate <OffsetX, OffsetY, 0>}
#declare Box = union
{
box{<0,0,0>,<Wi,Hi,1>
pigment { color rgbt <1, 1, 1, 0.5>}
}
}
object {Box translate <-Wi/2, -Hi/2, 0>}
Post a reply to this message
|
|
|
|
"Andrej" <and### [at] emailwithoutspamsi> wrote in message
news:4381d16b@news.povray.org...
>I have a offset problem with object balls. With box, it's ok. If I change
>the Wi and Hi, the box will remain in center but the balls wouldn't.
> ... snip ... #declare Hi=4;
> ... snip ...
> #declare OffsetY=-Hi/2; // Ouch...
> ... snip ...
> #while (CountY < Hi)
> ... snip ...
> object {balls translate <OffsetX, OffsetY, 0>}
>
Hi,
Your 'while' loop continues while CountY is less than Hi. ie. from CountY =
0 to CountY = 3, so you draw a sphere from 0 to 3, then you offset the array
of spheres by -2, so it won't be centred.
You probably want to use: #while (CountY <= Hi)
Regards,
Chris B.
Post a reply to this message
|
|