# Correctly transforming view in accordance to a surface?

This topic is 3971 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 ofthe camera relative to the first surface (we'll assume column-vector convention):AM = CM = A-1CHaving solved for M, we can now compute C' (the desired camera transform):C' = BMOr:C' = BA-1C
I didn't proofread that very carefully, but I'm pretty sure it's correct.

##### Share on other sites
Quote:
 Original post by jykI'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 ofthe camera relative to the first surface (we'll assume column-vector convention):AM = CM = A-1CHaving solved for M, we can now compute C' (the desired camera transform):C' = BMOr:C' = BA-1CI 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]:

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 on other sites
Quote:
 Original post by agi_shiWould 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 on other sites
Quote:
Original post by jyk
Quote:
 Original post by agi_shiWould 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 on other sites
Testing, testing....original poster indicated they were unable to reply to this unclosed topic...testing...

##### Share on other sites
Quote:
 Original post by agi_shiEDIT: 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!

##### 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].

Anyone?

*whistles*

*enjoys day*

*checks forums*

*bumps*

1. 1
2. 2
Rutin
23
3. 3
JoeJ
20
4. 4
5. 5

• 27
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631737
• Total Posts
3001944
×