Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Manhattan distance
Typical problems
Documentation
rot45 :: (Int, Int) -> (Int, Int) #
Rotates \((x, y)\) pair in 45 degree and scales \(\sqrt 2\). Note that \(x\) comes first in the pair.
2D Manhattan distance is definned as \(\Delta x + \Delta y\). After this transformation, it's calculated with \(\mathrm{max}(x, y)\).
This transformation applies \(\frac {1} {\sqrt 2} \begin{bmatrix} 1 && -1 \\ 1 && 1 \end{bmatrix} \), but without the cofficient.