POV-Ray : Newsgroups : povray.general : computed rotate in macros : Re: computed rotate in macros Server Time
12 Aug 2024 09:21:43 EDT (-0400)
  Re: computed rotate in macros  
From: John M  Dlugosz
Date: 1 Mar 1999 01:40:46
Message: <36da366e.0@news.povray.org>
Spider wrote in message <36D99EA7.F4436A97@bahnhof.se>...
>Another one in this discussion, I have several rotate and a translate, as
this :
>
>
>rotate <nX,0,0>
>rotate <0,nY,0>
>rotate <0,nZ,0>
>translate <0,nL,0>
>
>Now I wonder, is it possible to make this into only one rotate/translate,
or,
>even better into a matrix (I don't know the math, I only want to know if it
is
>possible, as so far.)
>If it is possible to make only one matrix, can I combine two of them into
only
>one ?? (yes, macro :-)




It sure is.  I don't know if it's worth doing it in POV script, though.
It's not exactly an object-oriented language.

    matrix M= I;  // identity matrix
    M.rotate (n*x);
    M.rotate (n*y);
    M.rotate (n*z);
    M.translate (whatever);
    // ... later
    someObject.rotate (M);  // do the whole thing as one step
    anotherObject.rotate (M);  // same value used here.

--John


Post a reply to this message

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