toy-lib-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Math.Manhattan

Description

Synopsis

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.