[Gambas-user] algorithm for scaling 2D coordinates centered on an arbitrary point

Kevin Fishburne kevinfishburne at ...1887...
Wed Aug 17 06:48:01 CEST 2011


I'm sure this is ridiculously simple, but my simple brain can't seem to 
figure it out.

I have a set of screen coordinates, xPos and yPos. I need to adjust 
their positions based on a zoom level, CameraZoom. The zoom level is 
relative to the center of the screen (swidth / 2, sheight / 2), and the 
zoom level range is from 1 to 2. If the zoom is at 1, the x and y 
coordinates wouldn't change. If the zoom is at 2, they would be half 
their previous distance from the center of the screen. This simulates 
the positions of objects changing as the camera zooms in and out.

There has to be some simple equation to produce this. I've attached the 
procedure that needs this just for reference. Any clues appreciated, as 
always.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Render.Texture()
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20110817/3b780331/attachment.ksh>


More information about the User mailing list