POV-Ray : Newsgroups : povray.off-topic : Ok, someone explain this in English... (exploring quaternions) : Re: Ok, someone explain this in English... (exploring quaternions) Server Time
7 Sep 2024 09:22:39 EDT (-0400)
  Re: Ok, someone explain this in English... (exploring quaternions)  
From: Patrick Elliott
Date: 27 Jun 2008 14:25:11
Message: <MPG.22ceddd392ce4ffa98a16e@news.povray.org>
In article <48649266$1@news.povray.org>, sco### [at] scottcom says...
> > Problem is, how the frack do you transpose the vectors for X,Y,Z to
> > something "valid" for an object using this system, without converting i
t
> > to euler values?
> 
> If I understand correctly, you are trying to set the orientation of an 
> object based on the camera position (so it appears to rotate in world spa
ce 
> as the camera moves), but with some limits etc, and return to SL a 
> quaternion that represents this orientation.
> 
> Does SL provide you with functions to help with creating and manipulating
 
> quaternions? That would make your life much easier, if not you'll need to
 
> read up on how to create quaternions for basic things like rotation about
 an 
> axis, combining rotations etc.
> 
Umm. Yes, but you missed one of my key points. That being the fact that 
every function that you have to call or action you have to perform in 
the script is going to add to the lag on the server end. From a purely 
practical standpoint, it would have been better to support the standard 
3 value Euler rotations, i.e., X,Y,Z, and do the conversion in the 
client. Instead, you have to do it in the script, using calls that will 
"force" the server to handle the conversion (I think.. Its damn 
confusing how SL handles this, since some stuff "must" run server side, 
but some is handled client side, like position and rotation functions 
for "attached" objects (those you wear).

So, the answer is, yes, they do provide means to do the conversions. I 
am asking if there is some way to do it without those, so I can reduce 
the number of actual functions I call in it. I strongly suspect that the 
way it works won't "allow" it, but I figured it wouldn't hurt to try. 
lol

> If you want to limit the rotations somehow, then I think you'll have to w
ork 
> them out as rotations about the X Y and Z axis first, limit them, then 
> convert to a quaternion.  I don't see any other way.
> 
> You should be able to work out the rotations about each axis that allow t
he 
> object to point directly to the camera using simple trig functions. 
> Probably just a pitch rotation about the left/right axis followed by a ya
w 
> rotation about the "up" axis.
> 
> Once you have them, limit them in any way you see fit, then convert those
 
> two rotations to quaternion form and multiply them!
> 
> To create a quaternion that rotates an angle a about a vector v=(vx,vy,
vz):
> 
> (cos(a/2) , vx sin(a/2) , vy sin(a/2) , vz sin (a/2) )
> 
> So to rotate 60 degrees about the x axis, you would use the quaternion:
> 
> (0.866,0.5,0,0)
> 
> The wikipedia pages on quaternion and quaternion rotations gives some goo
d 
> info:
> 
> http://en.wikipedia.org/wiki/Quaternion
> http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
>  
> 
> 

-- 
void main () {

    if version = "Vista" {
      call slow_by_half();
      call DRM_everything();
    }
    call functional_code();
  }
  else
    call crash_windows();
}

<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
 
3D Content, and 3D Software at DAZ3D!</A>


Post a reply to this message

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