mathcoordinate-systemscoords

Why does software often use an inverse coordinate system compared to regular math coord system?


As you likely know, in c#, the origin (0,0) of a plane is the upperleft corner. Going to the right and/or under is regarded as +, while going to the left and/or up is -. Opposed to this is the regular math coordsystem:

(0,0)=mid of plane, going up/right = +, down/left = -.

It's kinda counter-intuitive and can be annoying sometimes, since we're used (for years) to using the regular math coords, and you have to recalculate coords as well.

Is this a fundamental design flaw? And do you get used to it after a while? And which other languages use a different coord system like c#?


Solution

  • It is not C# but the display that uses a inverse coordinate system, this comes from the days back when the display was drawn in using a CRT and the image was drawn in top to bottom, left to right. That is why the coordinate system OS's use match that.

    Languages like C# are just wrapping the underlying OS's API and that is why C# uses it too.