I have a line that represents an axis, on the computer's screen, it has a model domain and a screen domain. For example the model domain can be [2, 10], and the screen domain [50, 400].
I need to move the first (or last) model domain number, to a specific screen location, without affecting anything except the first (or last) point of the line. For example, normally with the domains given above the 2 from the model domain would have a screen location of 50. Now I want that the 2 has, instead, for example, a screen location of 100. And to do this I have to change the location of the first point in the model domain. The screen domain must stay intact. The last point of the model domain also can't move.
My first approach was to map the screen domain offset (50 in this case) to a model domain offset and subtract this from the first (model) point of the line, which basically makes the model domain "expand" beyond the first point, effectively "moving" my point to the right (imagining an x-axis now). The problem with this, is that it doesn't consider that when expanding the model domain of the line, the ratio changes, so when I map from model domain value to screen domain value, it will not end at the screen position where I intended to move it.
So I have to integrate this ratio change into my equation. The problem can be described in short as "find a new start model domain value for line, such that the point with domain value X gets a new screen location Y".
Just to show that I "tried something", though it's ridiculous, I made some attempts, using the equation to calculate the ratio as starting point, e.g.
model domain value = screen domain value * model domain length / screen domain length
For the example above:
2 = 100 * (8 + X) / 350 where
X is the domain length "expansion" I need for the equation to become true, that is, such that the domain value 2 has a 100 screen location, but the result didn't make any sense. I feel I'm missing something very basic but now my head is closed. Appreciate any help!