POV-Ray : Newsgroups : povray.general : computed rotate in macros : Re: computed rotate in macros Server Time
12 Aug 2024 17:19:16 EDT (-0400)
  Re: computed rotate in macros  
From: John M  Dlugosz
Date: 2 Mar 1999 21:20:52
Message: <36dc9c84.0@news.povray.org>
Yes, two or three rotates can be turned into a single rotate.  But I'm not
certain that an arbitrary rotation can be expressed as a single POV rotate<>
argument.

To reduce the source filesize, why not use some macros?

Then again... (reading in a textbook) ... an arbitrary rotation can be
decomposed into five axis rotations.  Because one rotate<> command does
three such rotates (one on each axis), I can collapse that down to fewer
statements when consecutive rotates are performed in the proper order.  That
gives me three individual rotate commands.

So, an arbitrary rotation (any amount on any axis) can be expressed as three
rotate<> primitives in POV, or as one matrix primitive.

    rotate <0, 0, -theta>
    rotate <0, -phi, A>
    rotate <0,phi,theta>

where phi and theta are computed based on the desired axis of rotation, and
A is the amount to rotate along that axis.

--John

Spider wrote in message <36DBAB72.5E598A1C@bahnhof.se>...
>I actually hope to save space with this, since there are three rotations in
a
>row, repeated some 3000 times in a .inc file. I know that POV doesn't take
long
>to compute it, but I'd still think it was a good idea to reduce them, for
the
>sake of filesize. the difference would not be as big with a matrix, since
it
>requires a few more numbers than a rotate, so perhaps a way to apply two
rotates
>in a single one. I still haven't worked on it, since I don't think I have
the
>skills required.
>
>
>--
>//Spider
>( spi### [at] bahnhofse ) [ http://www.bahnhof.se/~spider/ ]
>#declare life = rand(seed(42))*sqrt(-1);


Post a reply to this message

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