MoI discussion forum
MoI discussion forum

Full Version: Setting camera from 3D scanner

Show messages: All  1-8  9-13

From: Michael Gibson
29 Aug 2017   [#9] In reply to [#6]
Hi track,

> The viewing direction expressed in the 3D world is rz, the "up" vector is ry and the "right" vector is rx.
>
> Today in Moi, I can set the position, the target and the field of view. But I don't know how to handle the
> leftRightAngle, upDownAngle and tiltAngle to get the same orientation.

So hopefully this is correct, I'm not thoroughly double checking it at the moment, but once you have set the position and target in MoI the viewing direction should match your rz and that also means you don't want to mess with the leftRightAngle and upDownAngle after that since they are alternate ways of setting the viewing direction.

Then tiltAngle will control the "up" direction's rotation around the view direction with respect to the world z axis direction.

The way the tilt angle is calculated is like this:

TempRight = CrossProduct( ViewDir, WorldZAxis )
if (TempRight.isDegenerate() )
TempRight = CrossProduct( ViewDir, WorldYAxis )

TempRight.Normalize()

NoTiltUpDir = CrossProduct( TempRight, ViewDir ).Normalize();


That's what will be the view's up direction for a "tiltAngle" of 0, you'd need to measure the angle between your view's up direction and that to get the angle to set to make them match.

Hope that helps!

- Michael
From: track
29 Aug 2017   [#10] In reply to [#7]
[rx; ry; rz] is a general rotation matrix. I'm using matlab notation
rx is the first row of my rotation matrix.
ry is the second row of my rotation matrix
ry is the third row of my rotation matrix
In my scanner there is no laser
From: track
29 Aug 2017   [#11] In reply to [#9]
Thanks this is what I was looking for.
From: bemfarmer
29 Aug 2017   [#12] In reply to [#10]
This link shows Matlab notation which appears to be like rx, ry, rz, as far as I can tell.
https://math.stackexchange.com/questions/219864/matlab-function-rotation-matrix

google search of "matlab rotation matrix 3d" brings up all sorts of good information and code, but your questions were answered by Michael :-)
- Brian
From: track
30 Aug 2017   [#13] In reply to [#12]
Your link is about contructing a rotation matrix along a given axis and with a given angle.
It is a general formula to build a rotation matrix

In my case, rx, ry and rz are three 3D vectors.
They are the rows of my rotation matrix.

Michael answered by question.

Show messages: All  1-8  9-13