yx-0.0.1.1: Row-major coordinates

Safe HaskellSafe
LanguageHaskell2010

Data.Geometry.YX

Description

A bitmap-friendly XY coordinate.

YX rather than XY since layout is row major (first row sorts before the second, etc.).

Synopsis

Documentation

data YX Source #

A 2D coordinate.

YX implements Num. Integers are converted to their diagonal equivalent (for example 2 becomes YX 2 2).

Constructors

YX 

Fields

Instances
Eq YX Source # 
Instance details

Defined in Data.Geometry.YX

Methods

(==) :: YX -> YX -> Bool #

(/=) :: YX -> YX -> Bool #

Num YX Source # 
Instance details

Defined in Data.Geometry.YX

Methods

(+) :: YX -> YX -> YX #

(-) :: YX -> YX -> YX #

(*) :: YX -> YX -> YX #

negate :: YX -> YX #

abs :: YX -> YX #

signum :: YX -> YX #

fromInteger :: Integer -> YX #

Ord YX Source # 
Instance details

Defined in Data.Geometry.YX

Methods

compare :: YX -> YX -> Ordering #

(<) :: YX -> YX -> Bool #

(<=) :: YX -> YX -> Bool #

(>) :: YX -> YX -> Bool #

(>=) :: YX -> YX -> Bool #

max :: YX -> YX -> YX #

min :: YX -> YX -> YX #

Show YX Source # 
Instance details

Defined in Data.Geometry.YX

Methods

showsPrec :: Int -> YX -> ShowS #

show :: YX -> String #

showList :: [YX] -> ShowS #

Ix YX Source # 
Instance details

Defined in Data.Geometry.YX

Methods

range :: (YX, YX) -> [YX] #

index :: (YX, YX) -> YX -> Int #

unsafeIndex :: (YX, YX) -> YX -> Int

inRange :: (YX, YX) -> YX -> Bool #

rangeSize :: (YX, YX) -> Int #

unsafeRangeSize :: (YX, YX) -> Int

rows :: (YX, YX) -> [[YX]] Source #

All coordinates, grouped by row.

up :: YX Source #

Basic steps.

left :: YX Source #

Basic steps.

right :: YX Source #

Basic steps.

down :: YX Source #

Basic steps.

steps4 :: [YX] Source #

Ordered array of the 4 base steps.

steps8 :: [YX] Source #

Ordered array of the 8 steps (4 base and 4 diagonal).

byteStringToArray :: IArray a e => (Char -> Maybe e) -> ByteString -> Either String (a YX e) Source #

Parse newline delimited bytestring into an array.

arrayToByteString :: IArray a e => (e -> Char) -> a YX e -> ByteString Source #