haccepted-0.1.0.0: Data structures and algorithms
Safe HaskellSafe-Inferred
LanguageHaskell2010

Geometry

Description

Simple utilities for 2D geometry

Synopsis

Documentation

data V2 Source #

Constructors

V2 !Int !Int 

Instances

Instances details
Eq V2 Source # 
Instance details

Defined in Geometry

Methods

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

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

Num V2 Source # 
Instance details

Defined in Geometry

Methods

(+) :: V2 -> V2 -> V2 #

(-) :: V2 -> V2 -> V2 #

(*) :: V2 -> V2 -> V2 #

negate :: V2 -> V2 #

abs :: V2 -> V2 #

signum :: V2 -> V2 #

fromInteger :: Integer -> V2 #

Ord V2 Source # 
Instance details

Defined in Geometry

Methods

compare :: V2 -> V2 -> Ordering #

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

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

(>) :: V2 -> V2 -> Bool #

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

max :: V2 -> V2 -> V2 #

min :: V2 -> V2 -> V2 #

Show V2 Source # 
Instance details

Defined in Geometry

Methods

showsPrec :: Int -> V2 -> ShowS #

show :: V2 -> String #

showList :: [V2] -> ShowS #

NFData V2 Source # 
Instance details

Defined in Geometry

Methods

rnf :: V2 -> () #

mag2 :: V2 -> Int Source #

The square of the magnitude of the vector.

dist2 :: V2 -> V2 -> Int Source #

The square of the distance between two vectors.

dot :: V2 -> V2 -> Int Source #

Dot product of two vectors.

cross :: V2 -> V2 -> Int Source #

Cross product of two vectors.

turn :: V2 -> V2 -> V2 -> Ordering Source #

The turn going from p1 to p2 to p3. Returns an Ordering representing left, no turn, or right. Mnemonic: LT stands for "left turn".