POV-Ray : Newsgroups : povray.advanced-users : Question about scale & translation : Re: Question about scale & translation Server Time
28 Jul 2024 22:23:43 EDT (-0400)
  Re: Question about scale & translation  
From: Andrew
Date: 2 Aug 2003 09:59:32
Message: <3f2bc3c4@news.povray.org>
"Steve Shelby" <ssh### [at] rexnetnet> wrote in message
news:3f2bbd6c@news.povray.org...
> Hi,
> I am not an advanced user, but I have a question that I think only an
> advanced user could answer. I will give a simplified example to make
it easy
> to visualize. Make a cylinder with a scale of 1, a second cylinder
with a
> scale of 1.5, a third cylinder scaled 2, a fourth scaled 2.5, and a
fifth
> scaled 3. I want the cylinders lined up so that the flat faces are
together.
> Cylinder #2 would be translated 1, cyl. #3 translated 2.5, cyl .#4
> translated 4.5, and cyl #5 translated 7. The translation for each
object is
> equal to the sum of the scales of each object preceding it. This is
not
> rocket science, easy enough to do. The problem is that I want to make
a
> scene that uses several hundred objects this way. I can easily use
Moray to
> make the hundreds of objects, scaled as required, but not translated
as
> required. Is there a way to make Povray compute the translation
numbers
> automatically? Any suggestion would be appreciated.
> Thank you,
> Steve Shelby
>
>


Your question is essentially "Does povray have scripting capability?",
so perhaps belongs in povray.newusers...

Anyway:

#declare loop = 0; //counter
#declare shift = 0; //cumulative size

#while (loop < 100)

 #declare shift = shift + (((loop-1)+1)/2);

    cylinder {<0,0,0>,<0,1,0>,0.2 scale (loop+1)/2 translate <0,shift,0>
pigment {color rgb 0.8}}

    #declare loop = loop + 1;
    #end


Post a reply to this message

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