Sign in to follow this  
nullsquared

Correctly transforming view in accordance to a surface?

Recommended Posts

EDIT: TEST EDIT! Hello all! Say that I have a surface, A. It is rotated and positioned randomly. Now, I have a surface, B. It is just like A, except with a different rotation and position, obviously. I also have a viewpoint, C. Now, my question is, how can I position and orient C with relativity to B, the way it is relative to A? Basically, I want to recreate the same view from C to A, but from C to B, by moving and rotating C. But my problem is, I can't figure out how to mathematically do so... (math has never been my strong point...) Ideas? Thanks in advance! [Edited by - agi_shi on August 23, 2007 11:41:56 AM]

Share this post


Link to post
Share on other sites
I'm going to guess you're looking for something like the following:
[ A is the transform matrix for the first surface ]
[ B is the transform matrix for the second surface ]
[ C is the transform (not view) matrix for the camera ]

We are first looking for M, the matrix that represents the transform of
the camera relative to the first surface (we'll assume column-vector convention):

AM = C
M = A-1C

Having solved for M, we can now compute C' (the desired camera transform):

C' = BM

Or:

C' = BA-1C
I didn't proofread that very carefully, but I'm pretty sure it's correct.

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
I'm going to guess you're looking for something like the following:
[ A is the transform matrix for the first surface ]
[ B is the transform matrix for the second surface ]
[ C is the transform (not view) matrix for the camera ]

We are first looking for M, the matrix that represents the transform of
the camera relative to the first surface (we'll assume column-vector convention):

AM = C
M = A-1C

Having solved for M, we can now compute C' (the desired camera transform):

C' = BM

Or:

C' = BA-1C
I didn't proofread that very carefully, but I'm pretty sure it's correct.


Wow, thanks a bunch!

There seems to be a minor problem though, and it's entirely my fault. I did not explain myself (sorry, I usually leave out critical details [sad]).

I'm trying to get the camera to the back of the second surface... The same relativity as to the front of the first one, but relative to the back of the second one.

Here's an image to describe what I mean... sometimes images are my best details [grin]:
descrip.
I'm try to get the "non-crossed-out" C prime.

Ideas?

Would rotating the second surface by 180 degrees (on the y-axis) before using its transformation matrix do this? Or do matrices not work like that ?

Share this post


Link to post
Share on other sites
Quote:
Original post by agi_shi
Would rotating the second surface by 180 degrees (on the y-axis) before using its transformation matrix do this?
Yeah, that seems like it should work. You can always give it a try and find out :-)

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
Quote:
Original post by agi_shi
Would rotating the second surface by 180 degrees (on the y-axis) before using its transformation matrix do this?
Yeah, that seems like it should work. You can always give it a try and find out :-)


Good point there, I should've just tried it [grin]. Anyways, it works exactly as planned! Thanks a great bunch!

Share this post


Link to post
Share on other sites
Quote:
Original post by agi_shi
EDIT: TEST EDIT!

Hello all!

Say that I have a surface, A. It is rotated and positioned randomly.

Now, I have a surface, B. It is just like A, except with a different rotation and position, obviously.

I also have a viewpoint, C.

Now, my question is, how can I position and orient C with relativity to B, the way it is relative to A?

Basically, I want to recreate the same view from C to A, but from C to B, by moving and rotating C. But my problem is, I can't figure out how to mathematically do so... (math has never been my strong point...)

Ideas? Thanks in advance!


grhodes_at_work test - testing quote/reply...

Share this post


Link to post
Share on other sites
I have a very similar question - what if I wanted to transform a direction the same way? I want it to point to B the same way it pointed to A. Would it be basically the same thing? Any quick mock-up to get me started (unless it's the exact same thing)?

EDIT: Thanks for fixing the topic, grhodes_at_work [smile].

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this