POV-Ray : Newsgroups : povray.off-topic : Flipping a quaternion Server Time
5 Sep 2024 11:26:07 EDT (-0400)
  Flipping a quaternion (Message 1 to 4 of 4)  
From: c
Subject: Flipping a quaternion
Date: 14 Aug 2009 08:53:33
Message: <4a855e4d$1@news.povray.org>
I'm trying to export data from Blender.
If you have ever used Blender you will see that the Y axis is pointing 
forward and the Z axis is pointing up.

My problem is that I need to flip everything so that the Y axis is up 
and the Z axis is forward, so basically swapping the two.
For vectors it's easy, just swap y and z :
[x, y, z] becomes [x, z, y]
and after a lot of searching on the internet I even how to flip a matrix:
{ rx, ry, rz, 0 }
{ ux, uy, uz, 0 }
{ lx, ly, lz, 0 }
{ px, py, pz, 1 }
becomes
{ rx, rz, ry, 0 }
{ lx, lz, ly, 0 }
{ ux, uz, uy, 0 }
{ px, pz, py, 1 }

Both of these seem to work but I can't find how to flip a quaternion.


Post a reply to this message

From: clipka
Subject: Re: Flipping a quaternion
Date: 14 Aug 2009 23:50:25
Message: <4a863081$1@news.povray.org>
c schrieb:
> I'm trying to export data from Blender.
> If you have ever used Blender you will see that the Y axis is pointing 
> forward and the Z axis is pointing up.
> 
> My problem is that I need to flip everything so that the Y axis is up 
> and the Z axis is forward, so basically swapping the two.

If all else fails, you can always use a rotate about the X axis by 90 
degrees, followed by a scale by <1,-1,1> to flip direction of the 
then-up Y axis.

Or just export the whole scene to use a fitting coordinate model, by 
defining appropriate up/right/direction and sky vectors in the camera 
statement.


Post a reply to this message

From: scott
Subject: Re: Flipping a quaternion
Date: 17 Aug 2009 06:56:03
Message: <4a893743@news.povray.org>
> Both of these seem to work but I can't find how to flip a quaternion.

A rotation quaternion is defined as (w,x,y,z) where xyz is the axis to 
rotate around and w is related to the rotation angle.  Would simply swapping 
the y and z elements around do what you want?


Post a reply to this message

From: c
Subject: Re: Flipping a quaternion
Date: 19 Aug 2009 11:50:54
Message: <4a8c1f5e@news.povray.org>
scott wrote:
>> Both of these seem to work but I can't find how to flip a quaternion.
> 
> A rotation quaternion is defined as (w,x,y,z) where xyz is the axis to 
> rotate around and w is related to the rotation angle.  Would simply 
> swapping the y and z elements around do what you want?
> 
> 

Now I've resorted to leaving the coordinates the same and just flipping 
the camera around instead,
and I've got everything working like that, but now I'm having problems 
flipping a matrix.
So for now I'm just going to leave it like it is and maybe come back to 
that later.


Post a reply to this message

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