Flipping the y-axis so that it is like the normal coordinate system

wfunction

Well-known member
Joined
Oct 31, 2006
Messages
46
Programming Experience
1-3
How do I do this correctly? (PictureBox)
I apply a transfrom which does this, but the problem is, strings are drawn upside-down too!
Help!
 
Of course strings are drawn upside down; the text rendering code written by Microsoft was written with the understanding that the Y axis is "flipped" as you put it. If you apply a transform to turn it the other way up just so your brain can work it out, the existing code doesnt take note of the transform.. It carries on drawing as if 0 is the top, and everything is rendered upside down, even dropshadows on boxes etc.

Another way to look at it is; if a programmer at microsoft is smart enough to learn how to think in "0,0 is top left" then you are too. Reprogram the way your brain thinks about this, dont try and transform it to the coordinate system you were taught in primary school..

The reason we teach infants to go up and right is because, standing on the ground, they cant go downwards only upwards. They also dont understand negative numbers and are told that it's not possible to have 2 apples and take away 3. They usually write from left to right which explains the positivity of both the axes.

School is a gradual refinement and correction of lies told because the brain at a certain age isnt really capable of logically appropriating the actual truth. Here's another refinement: Computers draw top down, left right. Know this, and get on with it ;)
 
Don't use transforms, just realize that you need the negated value of the y coordinate and handle that with simple math.
You advise not to use Transform in order to achieve a usable co-ord system so what is the best way scale a picture box so that I can draw objects in a 'real word' positions. For example, I've written a graphical display that will plot various file types in projected coordinates, that is eastings and northing. These are typically in the range of 6,000,000 N and 400,000 E. I have used ScaleTransform and TranslateTransform to make the origin equal to 0,0 at the bottom left corner of the picturebox. I then plot real world coords by adding an offset in the X and Y. This all works well and to overcome the problem with the flipped text I use a graphics path and rotate and transform that. This is where my problem starts as the quality of the text produced in this way is shocking.
 
I see no need to scale or transform in order to draw in the typical mathematical Cartesian coordinate system. The only thing you need to do is negate the y value and possibly offset it so it is at the lower left hand of the coordinate system (or middle, or where ever you need it to be).
 
Back
Top