[color=#000000][font=Arial,]I have a camera quaternion (a,b,c,d) and a cam position (camX, camY, camZ)
I have an object with 3d coordinates (x,y,z)[/font]
[color=#000000][font=Arial,]I need to calculate azimuth, elevation of objects relatively to the cam view direction & plane.[/font]
[color=#000000][font=Arial,]First question
If I keep the object in center of my view (I mean, if I aim at it with my cam), even If I rotate the cam, translate it keeping the object in the center, I should have the same azimuth value, right ??
I don't have that.[/font]
[color=#000000][font=Arial,]Second question, the calculation.
I'm doing (object coordinates - cam position), in order to translate the object to the cam.
I'm taking the resulting coordinates and make the sandwich product with the quaternion and its conjugate.
(I followed this for the pseudo code :http://fr.wikipedia....ns_l'espace)[/font]
[color=#000000][font=Arial,]Then, I have a vector result and I take X & Z component and calculate the atan2.[/font]
[color=#000000][font=Arial,]Does it seem right ?[/font]
[color=#000000][font=Arial,]any leads or explanation would help me a lot in my struggle[/font]
Calculation of azimuth & elevation of objects relative to a camera
#1, That's right. The normalized "object position - camera position"-vector would always be identical to the camera's tangent-vector. Both altitude and azimuth would equal zero.
#2. Easiest way would be to transform the obj-cam-vector into camera space (multiply by the camera's viewmatrix / inverse of its transformation).
Then the azimuth is calculated as: acos(dot(vec, z-axis)), elevation: acos(dot(vec, y-axis).
#2. Easiest way would be to transform the obj-cam-vector into camera space (multiply by the camera's viewmatrix / inverse of its transformation).
Then the azimuth is calculated as: acos(dot(vec, z-axis)), elevation: acos(dot(vec, y-axis).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement