POV-Ray : Newsgroups : povray.general : rotate in #declare??? : Re: rotate in #declare??? Server Time
2 Aug 2024 18:11:26 EDT (-0400)
  Re: rotate in #declare???  
From: N Shomber
Date: 17 Aug 2004 16:46:14
Message: <41226e96$1@news.povray.org>
Thanks

-Nathan

"Groucho" <jca### [at] terraes> wrote in message
news:4122614e$1@news.povray.org...
> JWV is right. You'll have the same problem if you use some random noise in
a
> isosurface or a texture. I usually change #declare by #macro that are
> processed at render time and not at parse time. Try this:
>
> #macro pole()
>  cylinder{
>   <0,0,0>,<0,1,0>,.01
>   rotate <0,0,rand(R1)*360>
>   pigment{
>    rgb 1
>   }
>   finish{
>    ambient 1
>   }
>  }
> #end
>
> #declare c=100;
> #while (c>0)
>  object{
>   pole()
>   translate <-1,0,0>
>  }
>  #declare c=c-1;
> #end
>
> .Groucho.
>
> "JWV" <jwv|at|planet.nl> wrote in message news:41225d79@news.povray.org...
> > hi,
> >
> > The problem is as follows:
> >
> > in the 1st version, where you declare the object first and rotate
"within"
> > the declare statement, it DOES rotate. But what you really want, is to
> have
> > it rotate randomly (?). This, it doesn't. It rotates around a fixed
angle
> > defined by the first (and only) time you use Rrand().
> >
> > in the 2nd version the angle is calculated EACH time the while loop
> reaches
> > Rrand(), and therefore the objects rotate around different angles.
> >
> > So, yes, what you see is perfectly correct :-).
> >
> > Hoping to be of help,
> >
> > JWV
> >
> >
> > "N Shomber" <nsh### [at] hotmailcom> wrote in message
> > news:41225b60$1@news.povray.org...
> > > Hi,
> > >
> > > I was working on creating a scene for POV-Comp using POV-Ray
> > > 3.6.1.icl8.win32 and came across this interesting behavior.
> > >
> > > I am trying to declare an object that is rotated at some random angle
> > around
> > > an axis.  I need to create many of them so I declared a single
instance
> > > first then used a #while loop to create all of them.
> > >
> > > I've found that if I include my rotate in the declaration, it doesn't
> make
> > > it to the final object for some reason, but if I include it in the
while
> > > object declaration, it does.  Is this what's supposed to happen?
> > >
> > > Sample code:
> > >
> > > #declare R1=seed(0);
> > >
> > > camera{
> > >  location <0,00,-3>
> > >  look_at <0,0,0>
> > > }
> > >
> > > #declare pole=
> > >  cylinder{
> > >   <0,0,0>,<0,1,0>,.01
> > >   rotate <0,0,rand(R1)*360>
> > >   pigment{
> > >    rgb 1
> > >   }
> > >   finish{
> > >    ambient 1
> > >   }
> > >  }
> > > ;
> > >
> > > #declare c=100;
> > > #while (c>0)
> > >  object{
> > >   pole
> > >   translate <-1,0,0>
> > >  }
> > >  #declare c=c-1;
> > > #end
> > >
> > > #declare c=100;
> > > #while (c>0)
> > >  object{pole
> > >   rotate <0,0,rand(R1)*360>
> > >   translate <1,0,0>
> > >  }
> > >  #declare c=c-1;
> > > #end
> > >
> > >
> >
> >
>
>


Post a reply to this message

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