davidrmiller / biosim4

Biological evolution simulator
Other
3.1k stars 435 forks source link

Coord::asDir() is 180 degrees backwards. #23

Closed GregEakin closed 2 years ago

GregEakin commented 2 years ago

The X and Y variables are swapped in the atan2() function. This takes us in the wrong direction.

davidrmiller commented 2 years ago

Take a closer look at a reference for how std::atan2() works -- it takes y as its first argument. Try calling the simulator's test function unitTestBasicTypes(). It has some tests to make sure that Coord::asDir() returns the correct direction, and I believe the proposed change triggers a failure. But thanks for checking the code; I'm sure there are plenty of bugs to be found.

GregEakin commented 2 years ago

I did not see that. Thanks. Turns out I had my unit test backwards.