Skip to main content
Cohesion, better formating, fixed typos, capitalized phrases.
Source Link

I have a problem understanding quaternions rotation in OpenGL. So far I have implemented all function and operators related to quaternions.They are definitely working right!. HovererHowever I can't find where i makeI'm making the mistake withingwithin rotation function.

LetsLet's say I have a a cube in 3d space at (xyz)(x=11,y=5 5,z=2 2) if I am not wrong the position in 4D is p=0+i+5j+2kp = 0 + i + 5j + 2k, and the orientation and rotation (0,0,0,0)(0, 0, 0, 0) in 4D space is q=1+0i+0j+0kq = 1 + 0i + 0j + 0k

Now I want to rotate it by 30 degrees along y-axis.

q = cos(a / 2) + (i xix + j yjy + k zkz)sin(a/2) 

So 30 degrees along y-axis is q=0.96+0.25j now:

Pout=q*Pin*conPout = q * Pin * con(q) Q=q*Pin=Q = q * Pin = (0.96+096 + 0.25j) * (0+1i+5j+2k0 + 1i + 5j + 2k) = -1.25+1.46+4.8+1.67 shall25 I+ normalizing1.46 it+ now4.8 or+ not? 1.67 

Shall I normalize it now or not?

conj(q)=0 = 0.96 - 0.25j Pout=Q*conPout = Q * con(q)=0+1 = 0 + 1.81+4,92+181 + 4.3292 + 1.Normalized32 

Normalized:

q q=0+0= 0 + 0.33i+033i + 0.91j+091j + 0.22k 

This is definitely the wrong answer according to this site

Rotating the object along the Y-axis by 30 degrees from a point (0,0,0) gives the correct result just by computing q.if If I use the above algorithm and multiply it by Pin I get (0,0,0,0)

Can you show me how to do it right step by step?

alsoAlso how do I to orbit one point along another. Lets say I have the given point above and I want it to orbit around the point (x=22,y=10 10,z= -2) using quaternions.

AlsoAnd when I manage to get the correct quaternion, how do I use it in the proper way along with opeGLopenGL glRotetefglRotatef.?

SOSo far my program runs like thatthis:

  1. quaternion=xQuaternion = x,y y,z z of object
  2. Compute RotatioRotation by X degrees along axes.
  3. Quaternion to Axis Angle
  4. glRotetefglRotatef (by result of point 3)
  5. quaternion=Quaternion = result of point 2
  6. goGo to point 2
  7. goGo to step 1

Do I always have to change quaternions to Axis-angles, or maybe there is there another way which allowsallow me to represent the rotation without conversion?

I have a problem understanding quaternions rotation in OpenGL. So far I have implemented all function and operators related to quaternions.They are definitely working right!. Hoverer I can't find where i make mistake withing rotation function

Lets say I have a a cube in 3d space at (x=1,y=5,z=2) if I am not wrong the position in 4D is p=0+i+5j+2k, and the orientation and rotation (0,0,0,0) in 4D space is q=1+0i+0j+0k

Now I want to rotate it by 30 degrees along y-axis.

q = cos(a/2) + (i x + j y + k z)sin(a/2) 

So 30 degrees along y-axis is q=0.96+0.25j now:

Pout=q*Pin*con(q) Q=q*Pin=(0.96+0.25j)*(0+1i+5j+2k)=-1.25+1.46+4.8+1.67 shall I normalizing it now or not?  conj(q)=0.96-0.25j Pout=Q*con(q)=0+1.81+4,92+1.32 .Normalized q=0+0.33i+0.91j+0.22k 

This is definitely the wrong answer according to this site

Rotating the object along the Y-axis by 30 degrees from a point (0,0,0) gives the correct result just by computing q.if I use above algorithm and multiply it by Pin I get 0,0,0,0

Can you show me how to do it right step by step?

also how to orbit one point along another. Lets say I have the given point above and I want it to orbit around the point (x=2,y=10,z=-2) using quaternions.

Also when I manage to get the correct quaternion how do I use it in the proper way along with opeGL glRotetef.

SO far my program runs like that

  1. quaternion=x,y,z of object
  2. Compute Rotatio by X degrees along axes.
  3. Quaternion to Axis Angle
  4. glRotetef(by result of point 3)
  5. quaternion= result of point 2
  6. go to point 2
  7. go to step 1

Do I always have to change quaternions to Axis-angles, or maybe there is another way which allows to represent the rotation without conversion?

I have a problem understanding quaternions rotation in OpenGL. So far I have implemented all function and operators related to quaternions.They are definitely working right!. However I can't find where I'm making the mistake within rotation function.

Let's say I have a a cube in 3d space at (xyz)(1, 5, 2) if I am not wrong the position in 4D is p = 0 + i + 5j + 2k, and the orientation and rotation (0, 0, 0, 0) in 4D space is q = 1 + 0i + 0j + 0k

Now I want to rotate it by 30 degrees along y-axis.

q = cos(a / 2) + (ix + jy + kz)sin(a/2) 

So 30 degrees along y-axis is q=0.96+0.25j now:

Pout = q * Pin * con(q) Q = q * Pin = (0.96 + 0.25j) * (0 + 1i + 5j + 2k) = -1.25 + 1.46 + 4.8 + 1.67 

Shall I normalize it now or not?

conj(q) = 0.96 - 0.25j Pout = Q * con(q) = 0 + 1.81 + 4.92 + 1.32 

Normalized:

q = 0 + 0.33i + 0.91j + 0.22k 

This is definitely the wrong answer according to this site

Rotating the object along the Y-axis by 30 degrees from a point (0,0,0) gives the correct result just by computing q. If I use the above algorithm and multiply it by Pin I get (0,0,0,0)

Can you show me how to do it right step by step?

Also how do I to orbit one point along another. Lets say I have the given point above and I want it to orbit around the point (2, 10, -2) using quaternions.

And when I manage to get the correct quaternion, how do I use it in the proper way along with openGL glRotatef?

So far my program runs like this:

  1. Quaternion = x, y, z of object
  2. Compute Rotation by X degrees along axes.
  3. Quaternion to Axis Angle
  4. glRotatef (by result of point 3)
  5. Quaternion = result of point 2
  6. Go to point 2
  7. Go to step 1

Do I always have to change quaternions to Axis-angles, or is there another way which allow me to represent the rotation without conversion?

Tweeted twitter.com/#!/StackGameDev/status/198913663799803904
attempted to correct grammar/usage, but unsure on some portions as to meaning
Source Link

I have a big problem with understanding quaternions rotation in OpenGL. So far I have implemented all function and operators related to quaternions.ThereThey are definitely working right!. Hoverer I can't find where i make mistake withing rotation function :(

Lets say I have a a cube in a point of 3d space at (x=1,y=5,z=2) if I am not wrong the position in 4D is p=0+i+5j+2k orientation, and the orientation and rotation (0,0,0,0) in 4D  space is q=1+0i+0j+0k now

Now I want to rotate it by 30 degreedegrees along y axis-axis.

q = cos(a/2) + (i x + j y + k z)sin(a/2) 

so 30degreesSo 30 degrees along y axis-axis is q=0.96+0.25j now now:

Pout=q*Pin*con(q) Q=q*Pin=(0.96+0.25j)*(0+1i+5j+2k)=-1.25+1.46+4.8+1.67 shall I normalizing it now or not? conj(q)=0.96-0.25j Pout=Q*con(q)=0+1.81+4,92+1.32 .Normalized q=0+0.33i+0.91j+0.22k 

Pout=Q*con(q)=0+1.81+4,92+1.32 .Normalized q=0+0.33i+0.91j+0.22k

thisThis is definitely the wrong answer according to this site http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/program/index.htmthis site

rotationRotating the object along the Y axis-axis by 30 degrees from a point (0,0,0)(0,0,0) gives resultthe correct result just by computing qq.if I use above algorithm and and mulmultiply it by PinPin I get 0,0,0,0:( Can0,0,0,0

Can you show me how to do it right step by step? also

also how to orbit one point along another.Let Lets say I have the given point above and I want it to orbitsorbit around the point(x=2,y=10,z=-2) (x=2,y=10,z=-2) using quaternions. Also

Also when I mangemanage to get correcttthe correct quaternion how todo I use it in athe proper way along with OPENGL glRotetefopeGL glRotetef. SO

SO far my program runs like that

  1. quaternion=x,y,z of object
  2. Compute Rotatio by X degrees along axes.
  3. Quaternion to Axis Angle
  4. glRotetef(by result of point 3)
  5. quaternion= result of point 2
  6. go to point 2 so on so on do I always have to change quaternions
  7. go to Axis angle or maybe there is another function which allows represent rotation without conversionstep 1

Do I always have to change quaternions to Axis-angles, or maybe there is another way which allows to represent the rotation without conversion?

I have a big problem with understanding quaternions rotation in OpenGL. So far I have implemented all function and operators related to quaternions.There are definitely working right!. Hoverer I can't find where i make mistake withing rotation function :(

Lets say I have a a cube in a point of 3d space (x=1,y=5,z=2) if I am not wrong the position in 4D is p=0+i+5j+2k orientation and rotation (0,0,0,0) in 4D  q=1+0i+0j+0k now I want to rotate it by 30 degree along y axis.

q = cos(a/2) + (i x + j y + k z)sin(a/2) 

so 30degrees along y axis is q=0.96+0.25j now

Pout=q*Pin*con(q) Q=q*Pin=(0.96+0.25j)*(0+1i+5j+2k)=-1.25+1.46+4.8+1.67 shall I normalizing it now or not? conj(q)=0.96-0.25j 

Pout=Q*con(q)=0+1.81+4,92+1.32 .Normalized q=0+0.33i+0.91j+0.22k

this is definitely wrong answer according to this site http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/program/index.htm

rotation object along Y axis by 30 degrees from a point (0,0,0) gives result correct just by computing q.if use above algorithm and and mul it by Pin I get 0,0,0,0:( Can you show me how to do it right step by step? also how to orbit one point along another.Let say I have given point above and I want it to orbits around point(x=2,y=10,z=-2) using quaternions. Also when I mange to get correctt quaternion how to use it in a proper way along with OPENGL glRotetef. SO far my program runs like that

  1. quaternion=x,y,z of object
  2. Compute Rotatio by X degrees along axes.
  3. Quaternion to Axis Angle
  4. glRotetef(by result of point 3)
  5. quaternion= result of point 2
  6. go to point 2 so on so on do I always have to change quaternions to Axis angle or maybe there is another function which allows represent rotation without conversion

I have a problem understanding quaternions rotation in OpenGL. So far I have implemented all function and operators related to quaternions.They are definitely working right!. Hoverer I can't find where i make mistake withing rotation function

Lets say I have a a cube in 3d space at (x=1,y=5,z=2) if I am not wrong the position in 4D is p=0+i+5j+2k, and the orientation and rotation (0,0,0,0) in 4D space is q=1+0i+0j+0k

Now I want to rotate it by 30 degrees along y-axis.

q = cos(a/2) + (i x + j y + k z)sin(a/2) 

So 30 degrees along y-axis is q=0.96+0.25j now:

Pout=q*Pin*con(q) Q=q*Pin=(0.96+0.25j)*(0+1i+5j+2k)=-1.25+1.46+4.8+1.67 shall I normalizing it now or not? conj(q)=0.96-0.25j Pout=Q*con(q)=0+1.81+4,92+1.32 .Normalized q=0+0.33i+0.91j+0.22k 

This is definitely the wrong answer according to this site

Rotating the object along the Y-axis by 30 degrees from a point (0,0,0) gives the correct result just by computing q.if I use above algorithm and multiply it by Pin I get 0,0,0,0

Can you show me how to do it right step by step?

also how to orbit one point along another. Lets say I have the given point above and I want it to orbit around the point (x=2,y=10,z=-2) using quaternions.

Also when I manage to get the correct quaternion how do I use it in the proper way along with opeGL glRotetef.

SO far my program runs like that

  1. quaternion=x,y,z of object
  2. Compute Rotatio by X degrees along axes.
  3. Quaternion to Axis Angle
  4. glRotetef(by result of point 3)
  5. quaternion= result of point 2
  6. go to point 2
  7. go to step 1

Do I always have to change quaternions to Axis-angles, or maybe there is another way which allows to represent the rotation without conversion?

added 4 characters in body
Source Link
user1075940
  • 655
  • 1
  • 9
  • 20

I have a big problem with understanding quaternions rotation in OpenGL. So far I have implemented all function and operators related to quaternions.There are definitely working right!. Hoverer I can't find where i make mistake withing rotation function :(

Lets say I have a a cube in a point of 3d space (x=1,y=5,z=2) if I am not wrong the position in 4D is p=0+i+5j+2k orientation and rotation (0,0,0,0) in 4D q=1+0i+0j+0k now I want to rotate it by 30 degree along y axis.

q = cos(a/2) + (i x + j y + k z)sin(a/2) 

so 30degrees along y axis is q=0.96+0.25j now

Pout=q*Pin*con(q) Q=q*Pin=(0.96+0.25j)*(0+1i+5j+2k)=-1.25+1.46+4.8+1.67 shall I normalizing it now or not? conj(q)=0.96-0.25j 

Pout=Q*con(q)=0+1.81+4,92+1.32 .Normalized q=0+0.33i+0.91j+0.22k

this is definitely wrong answer according to this site http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/program/index.htm

rotation object along Y axis by 30 degrees from a point (0,0,0) gives result correct just by computing q.if use above algorithm and and mul it by Pin I get 0,0,0,0:( Can you show me how to do it right step by step? also how to orbit one point along another.Let say I have given point above and I want it to orbits around point(x=2,y=10,z=-2) using quaternions. Also when I mange to get correctt quaternion how to use it in a proper way along with OPENGL glRotetef. SO far my program runs like that

  1. quaternion=x,y,z of object
  2. Compute Rotatio by X degrees along axes.
  3. Quaternion to Axis Angle
  4. glRotetef(by result of point 3)
  5. quaternion= result of point 2
  6. go to point 2 so on so on do I always have to change quaternions to Axis angle or maybe there is another function which allows represent rotation without conversion

I have a big problem with understanding quaternions rotation in OpenGL. So far I have implemented all function and operators related to quaternions.There are definitely working right!. Hoverer I can't find where i make mistake withing rotation function :(

Lets say I have a a cube in a point of 3d space (x=1,y=5,z=2) if I am not wrong the position in 4D is p=0+i+5j+2k orientation and rotation (0,0,0,0) in 4D q=1+0i+0j+0k now I want to rotate it by 30 degree along y axis.

q = cos(a/2) + (i x + j y + k z)sin(a/2) 

so 30degrees along y axis is q=0.96+0.25j now

Pout=q*Pin*con(q) Q=q*Pin=(0.96+0.25j)*(0+1i+5j+2k)=-1.25+1.46+4.8+1.67 shall I normalizing it now or not? conj(q)=0.96-0.25j 

Pout=Q*con(q)=0+1.81+4,92+1.32 .Normalized q=0+0.33i+0.91j+0.22k

this is definitely wrong answer according to this site http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/program/index.htm

rotation object along Y axis by 30 degrees from a point (0,0,0) gives result correct just by computing q.if use above algorithm and and mul it by Pin I get 0,0,0,0:( Can you show me how to do it right step by step? also how to orbit one point along another.Let say I have given point above and I want it to orbits around point(x=2,y=10,z=-2) using quaternions. Also when I mange to get correctt quaternion how to use it in a proper way along with OPENGL glRotetef. SO my program runs like that

  1. quaternion=x,y,z of object
  2. Compute Rotatio by X degrees along axes.
  3. Quaternion to Axis Angle
  4. glRotetef(by result of point 3)
  5. quaternion= result of point 2
  6. go to point 2 so on so on do I always have to change quaternions to Axis angle or maybe there is another function which allows represent rotation without conversion

I have a big problem with understanding quaternions rotation in OpenGL. So far I have implemented all function and operators related to quaternions.There are definitely working right!. Hoverer I can't find where i make mistake withing rotation function :(

Lets say I have a a cube in a point of 3d space (x=1,y=5,z=2) if I am not wrong the position in 4D is p=0+i+5j+2k orientation and rotation (0,0,0,0) in 4D q=1+0i+0j+0k now I want to rotate it by 30 degree along y axis.

q = cos(a/2) + (i x + j y + k z)sin(a/2) 

so 30degrees along y axis is q=0.96+0.25j now

Pout=q*Pin*con(q) Q=q*Pin=(0.96+0.25j)*(0+1i+5j+2k)=-1.25+1.46+4.8+1.67 shall I normalizing it now or not? conj(q)=0.96-0.25j 

Pout=Q*con(q)=0+1.81+4,92+1.32 .Normalized q=0+0.33i+0.91j+0.22k

this is definitely wrong answer according to this site http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/program/index.htm

rotation object along Y axis by 30 degrees from a point (0,0,0) gives result correct just by computing q.if use above algorithm and and mul it by Pin I get 0,0,0,0:( Can you show me how to do it right step by step? also how to orbit one point along another.Let say I have given point above and I want it to orbits around point(x=2,y=10,z=-2) using quaternions. Also when I mange to get correctt quaternion how to use it in a proper way along with OPENGL glRotetef. SO far my program runs like that

  1. quaternion=x,y,z of object
  2. Compute Rotatio by X degrees along axes.
  3. Quaternion to Axis Angle
  4. glRotetef(by result of point 3)
  5. quaternion= result of point 2
  6. go to point 2 so on so on do I always have to change quaternions to Axis angle or maybe there is another function which allows represent rotation without conversion
added 82 characters in body
Source Link
user1075940
  • 655
  • 1
  • 9
  • 20
Loading
Source Link
user1075940
  • 655
  • 1
  • 9
  • 20
Loading