Question

I have world(3d) points of a cube. I also have 3 different 3x4 RT matrices, which transform the 3d points into 2d image points. What I want to do in Sketchup is to change the camera view point(orientation) according to the given RT matrices. But, the Sketchup camera object provides eye(the 3d point where camera is situated), target(the 3d point where the camera is looking at) and up(axis information). How do I convert my RT matrix into eye, target and up? I'll be using Sketchup Ruby API.

Was it helpful?

Solution

Lets take the upper 3x3 of the RT matrix, you get-

RT=

R11 R12 R13 T1

R21 R22 R23 T2

R31 R32 R33 T3

R= R11 R12 R13 R21 R22 R23 R31 R32 R33

T= T1 T2 T3

yaxis=R21 R22 R23

zaxis=R31 R32 R33

You can change SU's camera with eye, target and up.

eye=-R(transpose)*T

target= eye+zaxis

up=-yaxis

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top