POV-Ray : Newsgroups : povray.general : Spiraling objects. Server Time
31 Oct 2024 10:21:24 EDT (-0400)
  Spiraling objects. (Message 1 to 7 of 7)  
From: Wil Hale
Subject: Spiraling objects.
Date: 31 Mar 2000 14:14:09
Message: <38e4f901$1@news.povray.org>
I thinks this is too advanced to put in new users so here it is.

Been trying to figure out how to do a spiral of spheres (or boxes or
anything)  Starting with a close sphere and generating the other spheres at
appropriate xyz locations depending on whether i wanted the spiral to move
away or closer.

It seems I could do this with a #while statement but the coding eludes me.

Thanks in advance...
wil hale
whh### [at] nvlarmymil


Post a reply to this message

From: Marc Schimmler
Subject: Re: Spiraling objects.
Date: 31 Mar 2000 14:53:18
Message: <38E5049D.63ABD291@ica.uni-stuttgart.de>
Wil Hale wrote:
> 
> I thinks this is too advanced to put in new users so here it is.
> 
> Been trying to figure out how to do a spiral of spheres (or boxes or
> anything)  Starting with a close sphere and generating the other spheres at
> appropriate xyz locations depending on whether i wanted the spiral to move
> away or closer.
> 
> It seems I could do this with a #while statement but the coding eludes me.
> 
> Thanks in advance...
> wil hale
> whh### [at] nvlarmymil

Hi Wil!

You are right about the #while statement.

Example


camera {location <0,0,0>
         look_at <0,0,10>  // look along the z axis}

light_source {<10,10,10> rgb 1}

#declare spiral_rad = 3.0;
#declare ax_step = 1/10;

#declare count = 0;
#while (count < 100)
 sphere {0,1 pigment{rgb <1,0,0>}  // sphere in origin radius 1
  translate <spiral_rad,0,0>       // spiral radius 
  rotate <0,count*10,0>            // eache sphere is rotate 10 degrees
  translate <0,0,ax_step>}         // per count move sphere 1/10 along 
                                   //the axis
 #declare count = count + 1;
#end 

I hope this one helps (and that I made no typos ...).

Marc
--
Marc Schimmler


Post a reply to this message

From: Bill DeWitt
Subject: Re: Spiraling objects.
Date: 31 Mar 2000 15:26:46
Message: <38e50a06$1@news.povray.org>
"Wil Hale" <whh### [at] nvlarmymil> wrote in message
news:38e4f901$1@news.povray.org...
> I thinks this is too advanced to put in new users so here it is.
>
> Been trying to figure out how to do a spiral of spheres (or boxes or
> anything)  Starting with a close sphere and generating the other spheres
at
> appropriate xyz locations depending on whether i wanted the spiral to move
> away or closer.
>
> It seems I could do this with a #while statement but the coding eludes me.
>

/* Here's the sort of thing I do. I use the sin/cos because it is easier to
control the radius if you want something other than a circular spiral. It
does require that you rotate the object if you want them all to face out...
*/


#declare Object = union {
                         sphere { 0, 0.20
                           pigment { rgb < 1.0, 0.0, 0.0 > }
                                      } // end sphere
                         sphere { 0, 0.075
                           pigment { rgb < 1.0, 0.0, 0.0 > }
                           translate < 0.0, 0.0, 0.2 >
                                      } // end sphere
                        } // end union

#declare NumberofObjects = 150;
#declare NumberofLoops = 5;
#declare XRadius = 2;
#declare ZRadius = 2;
#declare Height = 3

#declare I = 0;
#while ( I <= NumberofLoops )
    object { Object
               rotate < 0.0, 360*I, 0.0 >
               translate < sin(I*(2*pi))*XRadius,
                           ((Height/NumberofLoops)*I),
                           cos(I*(2*pi))*ZRadius >
           } // end object

#declare I = I + 1/(NumberofObjects/NumberofLoops);
#end


Post a reply to this message

From: Chris Huff
Subject: Re: Spiraling objects.
Date: 31 Mar 2000 15:48:55
Message: <chrishuff_99-4F3286.15511531032000@news.povray.org>
In article <38e4f901$1@news.povray.org>, "Wil Hale" 
<whh### [at] nvlarmymil> wrote:

> I thinks this is too advanced to put in new users so here it is.

This is one of the reasons "povray.advanced-users" was created... :-)


> Been trying to figure out how to do a spiral of spheres (or boxes or 
> anything)  Starting with a close sphere and generating the other 
> spheres at appropriate xyz locations depending on whether i wanted 
> the spiral to move away or closer.
> 
> It seems I could do this with a #while statement but the coding eludes 
> me.

A #while loop is the best way to do it. You can also wrap it in a macro, 
to save typing and avoid duplicated code.

#macro Spiral(Obj, Num, StartRadius, StopRadius, Revolutions)
    union {
        #local J=0;
        #while(J<Num)
            object {Obj
                translate x*((StopRadius-StartRadius)
                           *J/(Num-1)+StartRadius)
                rotate y*Revolutions*360*J/(Num-1)
            }
            #local J=J+1;
        #end
    // the } is left off the union so specific transformations,
    // texture, etc. can be specified more easily.
#end


An example of using this macro:
#declare TestObject = sphere  {< 0, 0, 0 >, 0.1}

Spiral(TestObject, 350, 2, 3, 3)
    texture {
        pigment {color White}
    }
    rotate y*90
}

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Peter Popov
Subject: Re: Spiraling objects.
Date: 31 Mar 2000 16:50:43
Message: <6BzlODvEYbeqkU7gSI1AU4f7RxiQ@4ax.com>
On Fri, 31 Mar 2000 14:14:05 -0500, "Wil Hale" <whh### [at] nvlarmymil>
wrote:

>I thinks this is too advanced to put in new users so here it is.
>
>Been trying to figure out how to do a spiral of spheres (or boxes or
>anything)  Starting with a close sphere and generating the other spheres at
>appropriate xyz locations depending on whether i wanted the spiral to move
>away or closer.
>
>It seems I could do this with a #while statement but the coding eludes me.

If you don't mind using meshes, check out Ken's links at povray.org
for Spiralizer. Powerful, easy to use and free.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usanet
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Gilles Tran
Subject: Re: Spiraling objects.
Date: 1 Apr 2000 05:06:38
Message: <38E5CA7E.7A309C4B@inapg.inra.fr>
Wil Hale wrote:

> Been trying to figure out how to do a spiral of spheres (or boxes or
> anything)  Starting with a close sphere and generating the other spheres at
> appropriate xyz locations depending on whether i wanted the spiral to move
> away or closer.

Whole tutorial and code about this particular problem here :
http://home.t-online.de/home/khs.cgag/povlup5e.htm
G.


Post a reply to this message

From: Wil Hale
Subject: Re: Spiraling objects. Tahnks for all your help
Date: 3 Apr 2000 08:27:18
Message: <38e88e26$1@news.povray.org>
Thanks for the assist.  My math skills rank right up there with Jethro from
the Beverly Hillbillies.  Note made concerning Advanced Users Group.


Wil Hale <whh### [at] nvlarmymil> wrote in message
news:38e4f901$1@news.povray.org...
> I thinks this is too advanced to put in new users so here it is.
>
> Been trying to figure out how to do a spiral of spheres (or boxes or
> anything)  Starting with a close sphere and generating the other spheres
at
> appropriate xyz locations depending on whether i wanted the spiral to move
> away or closer.
>
> It seems I could do this with a #while statement but the coding eludes me.
>
> Thanks in advance...
> wil hale
> whh### [at] nvlarmymil
>
>


Post a reply to this message

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