Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Synopsis
- type Angle = Float
- data V2 = V !Float !Float
- data V3 = V3 !Float !Float !Float
- data V4 = V4 !Float !Float !Float !Float
- data T2
- unit :: Angle -> V2
- (*.) :: V2 -> Float -> V2
- dot :: V2 -> V2 -> Float
- dot3 :: V3 -> V3 -> Float
- cross :: V2 -> V2 -> Float
- cross3 :: V3 -> V3 -> V3
- perpL :: V2 -> V2
- perpR :: V2 -> V2
- mul :: V3 -> Float -> V3
- divide :: V3 -> Float -> V3
- turn :: V2 -> V2 -> Ordering
- turnL :: V2 -> V2 -> Bool
- turnNL :: V2 -> V2 -> Bool
- turnR :: V2 -> V2 -> Bool
- turnNR :: V2 -> V2 -> Bool
- parv :: V2 -> V2 -> Bool
- square :: V2 -> Float
- mag :: V2 -> Float
- norm :: V2 -> V2
- dir :: V2 -> Angle
- v_len :: V3 -> Float
- set_len :: V3 -> Float -> V3
- inverse :: T2 -> T2
- (<>) :: Semigroup a => a -> a -> a
- translate :: V2 -> T2
- rotate :: Angle -> T2
- scale :: Float -> T2
- translationOf :: T2 -> V2
- rotationOf :: T2 -> Angle
- scaleOf :: T2 -> Float
- withTranslation :: T2 -> V2 -> T2
- withRotation :: T2 -> Angle -> T2
- withScale :: T2 -> Float -> T2
Documentation
2D vector: a pair of coordinates.
2D affine transformation. No shearing allowed, only translation,
rotation, and scaling. Transformations can be chained with
mappend
, and mempty
is the identity transformation.
turn :: V2 -> V2 -> Ordering infixl 5 Source #
Relative direction of two vectors: turn v1 v2
equals GT
if
v2
takes a left turn with respect to v1
, LT
if it is a right
turn, and EQ
if they are parallel.
translationOf :: T2 -> V2 Source #
The translation factor of a transformation.
rotationOf :: T2 -> Angle Source #
The rotation factor of a transformation.