Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Direction GetDirection4( Point3D from, Point3D to )
- {
- int dx = from.X - to.X;
- int dy = from.Y - to.Y;
- int rx = dx - dy;
- int ry = dx + dy;
- Direction ret;
- if ( rx >= 0 && ry >= 0 )
- ret = Direction.West;
- else if ( rx >= 0 && ry < 0 )
- ret = Direction.South;
- else if ( rx < 0 && ry < 0 )
- ret = Direction.East;
- else
- ret = Direction.North;
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement