POV-Ray : Newsgroups : povray.general : Local rotations : Re: Local rotations Server Time
31 Jul 2024 22:15:35 EDT (-0400)
  Re: Local rotations  
From: Tim Attwood
Date: 10 Aug 2006 21:46:46
Message: <44dbe186@news.povray.org>
>> ...  I'm trying to implement the Euler rotations
>> using the convention of Bunge.
I think this is right, had to look up Euler angles...

// Euler Angles in Bunge convention
#macro EulerRotate(A)
   #local xvector = vaxis_rotate(x,y,-A.x);
   #local yvector = vaxis_rotate(y,xvector,A.y);
   #local vX1 = vaxis_rotate(x,xvector,A.y);
   #local vY1 = vaxis_rotate(y,xvector,A.y);
   #local vZ1 = vaxis_rotate(z,xvector,A.y);
   #local vX2 = vaxis_rotate(x,yvector,-A.z);
   #local vY2 = vaxis_rotate(y,yvector,-A.z);
   #local vZ2 = vaxis_rotate(z,yvector,-A.z);
   transform {
      rotate <0,-A.x,0>
      matrix < vX1.x, vX1.y, vX1.z,
               vY1.x, vY1.y, vY1.z,
               vZ1.x, vZ1.y, vZ1.z, 0,0,0 >
      matrix < vX2.x, vX2.y, vX2.z,
               vY2.x, vY2.y, vY2.z,
               vZ2.x, vZ2.y, vZ2.z, 0,0,0 >
   }
#end

box{-0.5,0.5
   pigment{checker color z color y scale 0.1}
   EulerRotate(<15, 30 , 15>)
}


Post a reply to this message

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