Yonaba / Jumper

Fast, lightweight and easy-to-use pathfinding library for grid-based games
http://yonaba.github.io/Jumper
MIT License
613 stars 124 forks source link

y and x axis reversed #58

Open nekromoff opened 5 years ago

nekromoff commented 5 years ago

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.

Bobbyjoness commented 5 years ago

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

nekromoff commented 5 years ago

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 commented 5 years ago

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

Bobbyjoness commented 5 years ago

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}, } '''