POV-Ray : Newsgroups : povray.binaries.images : Symetric rotations : Re: Symetric rotations Server Time
17 Aug 2024 04:13:18 EDT (-0400)
  Re: Symetric rotations  
From: Tor Olav Kristensen
Date: 6 Nov 2001 03:26:23
Message: <3BE79E6F.82E26CDD@online.no>
Dan Johnson wrote:
> 
> Tor Olav Kristensen wrote:
> >
> > Dan,
> >
> > are you sure that your new basis vectors are
> > orthogonal to each other ?
> 
> They aren't that's the primary problem
> 
> > I.e.: You should get three zeros every time.
> > (Let me know if you think that I'm wrong about this.)
> 
> You are right.  The idea was to create a skewed matrix, and then fix it
> so that it is a rotation matrix, instead of a rotation, plus a bunch of
> sheers and scales.
> 
> > 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.
> 
> I know I don't have to use quats, but I don't know how to normalize a
> matrix (remove the skew).  All of the quaternion functions I used were
> already in my library.  It was a convenient way to get an idea of what
> things would look like with a matrix algebra solution.  The formula I
> used for converting a matrix to a quaternion is only designed to work
> with normalized rotation matrices, so I was pleased that my bad math
> worked relatively close to what I was looking for.

Sorry, I think that I misunderstood your problem.

Below is a macro you can try to use.

Tor Olav


#macro SymmRot(V)

  #local NewX = vrotate(x, V);
  #local NewY = vrotate(y, V);
  #local NewZ = vrotate(z, V);

  matrix <
    NewX.x, NewX.y, NewX.z,
    NewY.x, NewY.y, NewY.z,
    NewZ.x, NewZ.y, NewZ.z,
         0,      0,      0
  >

#end // macro SymmRot


// And here's some code to verify it.

#declare vRot = <3, 7, 11>*3;

#declare MySphere =
sphere {
  <0, 0, 0>, 0.01
  scale <1, 100, 1>
  translate 0.5*y
  rotate <-11, -8, -7>*3
}

object {
  MySphere
  rotate vRot
  pigment { color Yellow }
}

object {
  MySphere
  SymmRot(vRot)
  pigment { color Cyan }
}

object {
  MySphere
  transform Symetric_rotations(vRot)
  pigment { color Magenta }
}


Post a reply to this message

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