POV-Ray : Newsgroups : povray.binaries.images : Symetric rotations : Re: Symetric rotations Server Time
17 Aug 2024 04:12:12 EDT (-0400)
  Re: Symetric rotations  
From: Tor Olav Kristensen
Date: 5 Nov 2001 21:59:15
Message: <3BE751C0.ADA51228@online.no>
Dan,

are you sure that your new basis vectors are
orthogonal to each other ?

If you insert some debug lines after the #local
declarations within your Symetric_rotations()
macro, you can check this. Like this:

#macro Symmetric_rotations(V)

  #local New_x = vcross(vrotate(y, z*V.z), vrotate(z, y*V.y));
  #local New_y = vcross(vrotate(z, x*V.x), vrotate(x, z*V.z));
  #local New_z = vcross(vrotate(x, y*V.y), vrotate(y, x*V.x));
  #debug "\n"
  #debug str(vdot(New_x, New_y), 0, -1)
  #debug "\n"
  #debug str(vdot(New_x, New_z), 0, -1)
  #debug "\n"
  #debug str(vdot(New_y, New_z), 0, -1)
  #debug "\n"
  #local Trans_ma = array[12] {
    vdot(x, New_x), vdot(y, New_x), vdot(z, New_x),
    vdot(x, New_y), vdot(y, New_y), vdot(z, New_y),
    vdot(x, New_z), vdot(y, New_z), vdot(z, New_z),
    0, 0, 0
  }
  #local Trans_q = Matrix_array_2_quaternion(Trans_ma)
  #local Trans_m = transform { Q_matrix(Trans_q) }

  Trans_m

#end


I.e.: You should get three zeros every time.
(Let me know if you think that I'm wrong about this.)

Tor Olav


P.S.:
It's possible to do some simplifications to you macros  ;)

- And I think that you don't even have to use quats.
When you have got yourself some orthogonal basis vectors,
then just normalize them in order to make them orthonormal. 
And then try to use them directly within the matrix.


Dan Johnson wrote:
> 
> The povray rotate command is so unintuitive, that I have been thinking
> for many months about how to make things easier.  I have made many
> macros to make transformations easier for myself, but this one is
> special.  Instead of rotating around one axis at a time it rotates
> around all three at once.  My inspiration was an ordinary joystick.
> Joystick input is a single rotation away from the starting point, but
> internally it measures two rotations.  My thought was why can't I do the
> same thing in reverse.  I find the new x axis from rotations around the
> y, and z axis's.  The new y, and z axis's are found in similar ways.  I
> create a matrix using the old, and new basis vectors.
>...


Post a reply to this message

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