Well that's a good lesson. :)
I fully got step one and two. The idea of clamping the tx,ty values also makes fully sense.
I'm just curious about why you are working with center coordinates rather than left (top)
and right (bottom) boundaries and why they would be [-tx -ty]T
Say we have a scene and display having a width of 500. Now let's look at the
scene with sx = sy = 2 and tx=0, ty=0. So we would look at the top left quarter
of the scene. In order to not violate the boundaries I'd clamp the value of tx
between 0 and -500 (which corresponds to 0..250 in world coordinates). tbc..
If I evaluate your formula I'd get:
clamp(tx, -125, 125) which I can't make use of?
I'd use this formula for getting the bounds:
var bound = {
x: (1 - tView.sx) * display.width,
y: (1 - tView.sy) * display.height
};
Which yields bound.x = -500 for sx = 2
So are there any specific advantages of using the center point or should I go with
left and right bounds. Anyways for understanding please explain me the
center-point approach. :)
Thanks again that was totally helpful! :)
-- Michael