Jump to content

  • Log In with Google      Sign In   
  • Create Account


get a vertex B from vertex A and Quaternion


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 m3t4lukas   Members   -  Reputation: 210

Like
0Likes
Like

Posted 18 November 2013 - 06:24 AM

Hello guys,

I have a problem with my third person camera. I want to find out the position of the camera and the position of the look at spot. I know how to calculate this with α, β and γ angles but I really don't have a clue how to calculate verticex B based on a vertex A, a quaternion and a distance between vertices A and B.

 

It would be great if anyone could provide formulars or point the direction to go.

 

Greetings

Lukas


Edited by m3t4lukas, 18 November 2013 - 06:27 AM.


Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 12844

Like
0Likes
Like

Posted 18 November 2013 - 07:26 AM

If you post the formulas that work for you based on three angles, perhaps I can help you convert them to something that works with a quaternion. As it stands, I have no idea what the connection between A, B and the rotation is.



#3 m3t4lukas   Members   -  Reputation: 210

Like
0Likes
Like

Posted 18 November 2013 - 08:28 AM

Hi,

 

thanks for the quick reply. Here are the formular I know which I would use (assuming y-up):

vertexB.x = vertexA.x + (cos(yaw * PI / 180) * radius)
vertexB.y = vertexA.y + (sin(pitch * PI / 180) * sin(yaw * PI / 180) * radius)
vertexB.z = vertexA.z + (cos(pitch * PI / 180) * sin(yaw * PI / 180) * radius)

so how do I calculate such a thing (which is a spherical movement) with a quaternion?

 

Greetings

Lukas



#4 Álvaro   Crossbones+   -  Reputation: 12844

Like
1Likes
Like

Posted 18 November 2013 - 09:33 AM

Apply the rotation described by the quaternion to the vector (radius,0,0), then add the result to vertex A.

 

B = A + interpret_imaginary_part_as_3D_vector(q * i * conj(q)); // Here "i" means the quaternion (0 + 1*i + 0*j + 0*k)

 

Does that do what you want?


Edited by Álvaro, 18 November 2013 - 09:34 AM.


#5 m3t4lukas   Members   -  Reputation: 210

Like
0Likes
Like

Posted 18 November 2013 - 09:53 AM

Thanks again Álvaro,

 

I do have one querstion regarding your formula.


B = A + interpret_imaginary_part_as_3D_vector(q * i * conj(q));

What does the interpret_imaginary_part_as_3D_vector function do?

 

Thanks a lot so far :)

Lukas



#6 Álvaro   Crossbones+   -  Reputation: 12844

Like
1Likes
Like

Posted 18 November 2013 - 12:22 PM


What does the interpret_imaginary_part_as_3D_vector function do?

 

It takes a quaternion (a + b*i + c*j + d*k) and returns the 3D vector (b, c, d).


Edited by Álvaro, 18 November 2013 - 12:22 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS