Jump to content
  • Advertisement
Sign in to follow this  
aseg

Applying the same translation to images of varying size

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a 1600 x 1200 image, and a 400x300 version of the same. I applied translation(tx,ty) to the 1600x1200 image. To apply the corresponding translation to the 400x300 image, I just changed the translation to: (tx/4 , ty/4) as the smaller is 1/4th the size. (1) Is that assumption correct? Also, if the post-translation origin for the big image is (ox,oy), (2) would the post-translation origin for the small image be (ox/4,oy/4) along the same lines? Thanks a lot, Abhi [Edited by - aseg on June 18, 2009 4:29:12 PM]

Share this post


Link to post
Share on other sites
Advertisement
I may be misintepreting what your after, but i dont think size comes into it...

In that if i translate an object (5,-5) it will move 5 units up, and 5 units left no matter the size if the reference point stays the same.

So object 1's origin is 0,0 and object 2's origin is also 0,0... the translation will move both objects to be the same origin points.

If you were to change the screen resolution at this point however, then i would say your logic would hold.

In that object 1's origin on a 1600x1200 screen could be 0,0... object 2's origin on a 400x300 screen could be 0,0... moving both images relative to the screen size would require a scaled translation. Object 1 would need to move 800,600 to have the origin in the centre of the screen while object 2 would need to move 200,150 (your scale of 4 that you have referred to.)

Share this post


Link to post
Share on other sites
I will try another approach, as I haven't fully understood what you're after.

When you apply a translation of (tx,ty) over the 1600x1200 image, you move a certain percentage of the image, in this case, tx/1600 and ty/1200. Think about normalized coordinates. Map you 1600x1200 image to a quad of know and common width and height. By your example, a 4x3 quad:

(1600,1200) (4,3)
*-------* *--------*
| | => | |
| | | |
(0,0) *-------* (0,0) *--------*


That way, take your image and whenever you say translate(.5,.5), it'll be the same on any image you have. So, for your points:
Quote:
(1) Is that assumption correct?
Yes
Quote:
(2) would the post-translation origin for the small image be (ox/4,oy/4) along the same lines?
I did not understand what you are asking

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!