Ok, here's the deal. Images have their positive y axis oriented downward so the origin is top-left, right? Arma uses a cartesian plane for map coordinates. The result is that if you pass the y-values unmodified (which is perfectly legal!), the map image gets reversed like in a mirror. This is usually not the desired behavior.
So, there are conversions. Which is where y'all are at, I'm just trying to reset the coordinate discussion.
The first conversion we've encountered is rendering a map to an image. For that, the mirror image is actually acceptable, although unexpected behavior. To get the expected behavior, this conversion is the best:
y = max(y) - current(y)
Where max(y) is the maximum value of the y coordinate and current(y) is the y coordinate for the point you're currently converting. X values don't change at all! The x axis is already fine. In fact, ideally you'd do your final coordinate conversion after you convert the y coordinates, which nemo had to do on his map previewer to make sure negative x values would appear and that the image would be centered correctly regardless of where you located your origin in relation to the rest of the map. Anyway, this y coordinate conversion isn't mathematically correct because the points are actually moved on the plane, but we're not after mathematical perfection--we're after displaying the image the way the map maker likely visualized it in his head.
So now wrtlprnft is trying to go the other way, he needs to convert y coordinates from an image back to cartesian. This is fun.
I think he said currently he does 0-y, which is mathematically correct. But it's not consistent with what the previewer does, and it probably needs to be. I figure that a map maker is still wanting to locate the origin at the lower-left corner instead of the upper-left corner, so now the transformation needs to be in reverse.
Actually, I think using the same transformation that's used the other way will work. I.e. y = max(y) - current(y) . Side point: don't get lost in the negative signs, the problem corrects itself.
Finally, the problem of the origin. If you want to use this as your primary way to make maps, you're going to either need a way for the map maker to specify where he wants to locate the origin, or he's going to have to live with only working in the first quadrant. Got any ideas on how to let the map maker locate his origin?
If you allow the origin to be placed at any arbitrary point in the image (or outside the image), then you basically need to do the y-axis conversion mentioned, then you need to add the origin's location in relation to the image's coordinate system. It might be subtract, check your signs on it! (I had to do this in Acme to allow the user to move around on the map
Here's why that transformation is the right one for expected behavior:
To relocate a point in relation to a line on a plane, you just subtract the point's y-coordinate from the line's y-coordinate. It's f(x) - g(x) . For example, if f(x) = x, then f(x) - sin(x) will wrap a sin curve around the line y=x, right? It's the same thing here, however the line we're wanting to relocate around is the line at y=max(g(x) ) , where g(x) is your map (and it's not really a function in spite of me using functional notation). So if y=max(g(x) ) is f(x), and g(x) is the map, you do f(x) - g(x), which is the maximum value of the y-coordinate minues the y coordinate for a point on the map. (sorry, have had a little too many discussions on this topic where we always go through the reasoning from the beginning and always wind up with this solution, can we just jump to this solution now and build from it?)