Safe Haskell | None |
---|

Basic cartesian geometry operations on 2D vectors.

- newtype VectorXY = VectorXY (X, Y)
- shiftXY :: PointXY -> VectorXY -> PointXY
- movesXY :: [VectorXY]
- movesCardinalXY :: [VectorXY]
- chessDistXY :: VectorXY -> Int
- euclidDistSqXY :: VectorXY -> Int
- negXY :: VectorXY -> VectorXY
- vicinityXY :: (X, Y, X, Y) -> PointXY -> [PointXY]
- vicinityCardinalXY :: (X, Y, X, Y) -> PointXY -> [PointXY]

# Documentation

2D vectors in cartesian representation.

Vectors of all unit moves in the chessboard metric, clockwise, starting north-west.

movesCardinalXY :: [VectorXY]Source

Vectors of all cardinal direction unit moves, clockwise, starting north.

chessDistXY :: VectorXY -> IntSource

The lenght of a vector in the chessboard metric, where diagonal moves cost 1.

euclidDistSqXY :: VectorXY -> IntSource

Squared euclidean length of a vector.

All (8 at most) closest neighbours of a point within an area.