I can tell you why. I need it for mirroring. Imagine a 3D environment
you are watching in ego perspective (Dungeon Master like). There is a
walk way for NPCs from left to right in steps of 5 positions (0-4,
each position represents a coordinate pair on which the NPC is
painted). So, position 0 is the most left while position 4 is the most
right on the screen.
There is now a NPC passing the way from 0 to 1 and waiting there
(quite on the left border of the screen). Now you pass him crosswise,
turn by 180 degrees and watch him again. Ooops he is still standing on
the left side on the screen but by mirroring he should now stand on
position 3 (on the right side).
I was looking for a easy way how to calculate the new position when
mirroring happens. Based on my example: How do I come from 1 to 3? I
use 0 are mirror and subtract 4 from 1 = -3. The negavite value is not
a valid position so..... abs()
Based on my example it works for all values
0 <-> 4
1 <-> 3
2 <-> 2
3 <-> 1
4 <-> 0
Thats all about. If there is a better way, please let me know.
Farai