Copyright | (c) Alexey Kuleshevich 2019-2020 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <lehins@yandex.ru> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data V2 a = V2 !a !a
- data V3 a = V3 !a !a !a
- showV3 :: Show a => V3 a -> String
- dotProduct :: Num a => V3 a -> V3 a -> a
- data M3x3 a = M3x3 {}
- showM3x3 :: Show a => M3x3 a -> String
- detM3x3 :: Num a => M3x3 a -> a
- invertM3x3 :: Fractional a => M3x3 a -> M3x3 a
- multM3x3byV3 :: Num a => M3x3 a -> V3 a -> V3 a
- multM3x3byM3x3 :: Num a => M3x3 a -> M3x3 a -> M3x3 a
- multM3x3byV3d :: Num a => M3x3 a -> V3 a -> M3x3 a
- transposeM3x3 :: M3x3 a -> M3x3 a
- class (Show e, Eq e, Num e, Typeable e, Unbox e, Storable e) => Elevator e where
- maxValue :: e
- minValue :: e
- fieldFormat :: e -> FieldFormat
- toShowS :: e -> ShowS
- toWord8 :: e -> Word8
- toWord16 :: e -> Word16
- toWord32 :: e -> Word32
- toWord64 :: e -> Word64
- toRealFloat :: (Elevator a, RealFloat a) => e -> a
- fromRealFloat :: (Elevator a, RealFloat a) => a -> e
- toFloat :: e -> Float
- toDouble :: e -> Double
- fromDouble :: Double -> e
- (//) :: e -> e -> e
- module Data.Word
- clamp01 :: RealFloat a => a -> a
- showsType :: Typeable t => proxy t -> ShowS
- asProxy :: p -> (Proxy p -> t) -> t
2D
A 2D vector with x
and y
coordinates.
V2 !a !a |
Instances
Functor V2 Source # | |
Applicative V2 Source # | |
Foldable V2 Source # | |
Defined in Graphics.Color.Algebra fold :: Monoid m => V2 m -> m # foldMap :: Monoid m => (a -> m) -> V2 a -> m # foldMap' :: Monoid m => (a -> m) -> V2 a -> m # foldr :: (a -> b -> b) -> b -> V2 a -> b # foldr' :: (a -> b -> b) -> b -> V2 a -> b # foldl :: (b -> a -> b) -> b -> V2 a -> b # foldl' :: (b -> a -> b) -> b -> V2 a -> b # foldr1 :: (a -> a -> a) -> V2 a -> a # foldl1 :: (a -> a -> a) -> V2 a -> a # elem :: Eq a => a -> V2 a -> Bool # maximum :: Ord a => V2 a -> a # | |
Traversable V2 Source # | |
Eq a => Eq (V2 a) Source # | |
Floating a => Floating (V2 a) Source # | |
Fractional a => Fractional (V2 a) Source # | |
Num a => Num (V2 a) Source # | |
Ord a => Ord (V2 a) Source # | |
Elevator a => Show (V2 a) Source # | |
Storable e => Storable (V2 e) Source # | |
3D
A 3D vector with x
, y
and z
coordinates.
V3 !a !a !a |
Instances
Functor V3 Source # | |
Applicative V3 Source # | |
Foldable V3 Source # | |
Defined in Graphics.Color.Algebra fold :: Monoid m => V3 m -> m # foldMap :: Monoid m => (a -> m) -> V3 a -> m # foldMap' :: Monoid m => (a -> m) -> V3 a -> m # foldr :: (a -> b -> b) -> b -> V3 a -> b # foldr' :: (a -> b -> b) -> b -> V3 a -> b # foldl :: (b -> a -> b) -> b -> V3 a -> b # foldl' :: (b -> a -> b) -> b -> V3 a -> b # foldr1 :: (a -> a -> a) -> V3 a -> a # foldl1 :: (a -> a -> a) -> V3 a -> a # elem :: Eq a => a -> V3 a -> Bool # maximum :: Ord a => V3 a -> a # | |
Traversable V3 Source # | |
Eq a => Eq (V3 a) Source # | |
Floating a => Floating (V3 a) Source # | |
Fractional a => Fractional (V3 a) Source # | |
Num a => Num (V3 a) Source # | |
Ord a => Ord (V3 a) Source # | |
Elevator a => Show (V3 a) Source # | |
Storable e => Storable (V3 e) Source # | |
dotProduct :: Num a => V3 a -> V3 a -> a Source #
Mulitply a 1x3 vector by a 3x1 vector, i.e. dot product.
Since: 0.1.0
A 3x3 Matrix
Instances
Functor M3x3 Source # | |
Applicative M3x3 Source # | |
Foldable M3x3 Source # | |
Defined in Graphics.Color.Algebra fold :: Monoid m => M3x3 m -> m # foldMap :: Monoid m => (a -> m) -> M3x3 a -> m # foldMap' :: Monoid m => (a -> m) -> M3x3 a -> m # foldr :: (a -> b -> b) -> b -> M3x3 a -> b # foldr' :: (a -> b -> b) -> b -> M3x3 a -> b # foldl :: (b -> a -> b) -> b -> M3x3 a -> b # foldl' :: (b -> a -> b) -> b -> M3x3 a -> b # foldr1 :: (a -> a -> a) -> M3x3 a -> a # foldl1 :: (a -> a -> a) -> M3x3 a -> a # elem :: Eq a => a -> M3x3 a -> Bool # maximum :: Ord a => M3x3 a -> a # | |
Traversable M3x3 Source # | |
Eq a => Eq (M3x3 a) Source # | |
Floating a => Floating (M3x3 a) Source # | |
Fractional a => Fractional (M3x3 a) Source # | |
Num a => Num (M3x3 a) Source # | |
Elevator a => Show (M3x3 a) Source # | |
invertM3x3 :: Fractional a => M3x3 a -> M3x3 a Source #
Invert a 3x3 matrix.
Since: 0.1.0
multM3x3byV3 :: Num a => M3x3 a -> V3 a -> V3 a Source #
Mulitply a 3x3 matrix by a 3x1 vector, while getting a vector back.
Since: 0.1.0
multM3x3byV3d :: Num a => M3x3 a -> V3 a -> M3x3 a Source #
Multiply a 3x3 matrix by another 3x3 diagonal matrix represented by a 1x3 vector
transposeM3x3 :: M3x3 a -> M3x3 a Source #
class (Show e, Eq e, Num e, Typeable e, Unbox e, Storable e) => Elevator e where Source #
A class with a set of functions that allow for changing precision by shrinking and streatching the values.
fieldFormat :: e -> FieldFormat Source #
toShowS :: e -> ShowS Source #
This is a pretty printer for the value.
toWord8 :: e -> Word8 Source #
Values are scaled to [0, 255]
range.
toWord16 :: e -> Word16 Source #
Values are scaled to [0, 65535]
range.
toWord32 :: e -> Word32 Source #
Values are scaled to [0, 4294967295]
range.
toWord64 :: e -> Word64 Source #
Values are scaled to [0, 18446744073709551615]
range.
toRealFloat :: (Elevator a, RealFloat a) => e -> a Source #
Values are scaled to [0.0, 1.0]
range.
fromRealFloat :: (Elevator a, RealFloat a) => a -> e Source #
Values are scaled from [0.0, 1.0]
range.
toFloat :: e -> Float Source #
Values are scaled to [0.0, 1.0]
range.
toDouble :: e -> Double Source #
Values are scaled to [0.0, 1.0]
range.
fromDouble :: Double -> e Source #
Values are scaled from [0.0, 1.0]
range.
(//) :: e -> e -> e infixl 7 Source #
Division that works for integral types as well as floating points. May throw an exception.
Instances
module Data.Word