POV-Ray : Newsgroups : povray.general : Center of OBJECT : Center of OBJECT Server Time
1 Aug 2024 10:19:44 EDT (-0400)
  Center of OBJECT  
From: Andrej
Date: 21 Nov 2005 08:53:47
Message: <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.



//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

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