Jumper icon indicating copy to clipboard operation
Jumper copied to clipboard

y and x axis reversed

Open nekromoff opened this issue 5 years ago • 4 comments

One would expect to have x followed by y (.e.g my grid is grid[x][y]). This engine unfortunately uses non-standard y first and then x second [y][x]. Took me few days to identify the culprit. Maybe this report will help somebody.

nekromoff avatar Feb 01 '19 20:02 nekromoff

In cs universally its y followed by x. I do not know why, but his code his correct.

Bobbyjoness avatar May 14 '19 17:05 Bobbyjoness

The code is not correct or incorrect. However, the standards are X-Y, it's basic Cartesian system (even, if Y actually starts based on old CRTs from the top, the order is X followed by Y). https://en.wikipedia.org/wiki/Cartesian_coordinate_system

nekromoff avatar May 14 '19 18:05 nekromoff

Also, it should be documented, if it's not using the standard X-Y order. It is not.

nekromoff avatar May 14 '19 18:05 nekromoff

For points yes it is x,y. but for 2d arrays in code visually its obvious that the first number specifies the row i.e y. The second number specifies the column i.e x. Y-X is the standard order in CS for grids and 2d arrays because in reality it is Row-Column which is what matches up with the way the code looks. I am not saying points in general are specified as Y-X because they are not. but when it comes to storage it is stored as Y-X. ''' { {1,1,1}, {1,1,1}, {1,1,1}, } '''

Bobbyjoness avatar May 14 '19 19:05 Bobbyjoness