Safe Haskell  None 

Language  Haskell2010 
This module is a reduction of the Linear
package
from Edward Kmett to match just the need of Rasterific.
If the flag embed_linear
is disabled, this module is
just a reexport from the real linear package.
Synopsis
 newtype V1 a = V1 a
 data V2 a = V2 !a !a
 data V3 a = V3 !a !a !a
 data V4 a = V4 !a !a !a !a
 class R1 t where
 _x :: Lens' (t a) a
 class R2 t where
 _y :: Lens' (t a) a
 class Functor f => Additive f where
 class Num a => Epsilon a where
 class Additive f => Metric f where
 (^*) :: (Functor f, Num a) => f a > a > f a
 (^/) :: (Functor f, Floating a) => f a > a > f a
 normalize :: (Floating a, Metric f, Epsilon a) => f a > f a
Documentation
A 1dimensional vector
V1 a 
Instances
Functor V1 #  
Applicative V1 #  
Foldable V1 #  
Defined in Graphics.Rasterific.Linear fold :: Monoid m => V1 m > m # foldMap :: Monoid m => (a > m) > V1 a > m # foldr :: (a > b > b) > b > V1 a > b # foldr' :: (a > b > b) > b > V1 a > b # foldl :: (b > a > b) > b > V1 a > b # foldl' :: (b > a > b) > b > V1 a > b # foldr1 :: (a > a > a) > V1 a > a # foldl1 :: (a > a > a) > V1 a > a # elem :: Eq a => a > V1 a > Bool # maximum :: Ord a => V1 a > a #  
Traversable V1 #  
Additive V1 #  
R1 V1 #  
Defined in Graphics.Rasterific.Linear  
Eq a => Eq (V1 a) #  
Num a => Num (V1 a) #  
Show a => Show (V1 a) #  
Epsilon a => Epsilon (V1 a) #  
Defined in Graphics.Rasterific.Linear 
A 2dimensional vector
>>>
pure 1 :: V2 Int
V2 1 1
>>>
V2 1 2 + V2 3 4
V2 4 6
>>>
V2 1 2 * V2 3 4
V2 3 8
>>>
sum (V2 1 2)
3
V2 !a !a 
Instances
Functor V2 #  
Applicative V2 #  
Foldable V2 #  
Defined in Graphics.Rasterific.Linear fold :: Monoid m => V2 m > 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 #  
Metric V2 #  
Additive V2 #  
R2 V2 #  
Defined in Graphics.Rasterific.Linear  
R1 V2 #  
Defined in Graphics.Rasterific.Linear  
PointFoldable Point #  Just apply the function 
Defined in Graphics.Rasterific.Types foldPoints :: (b > Point > b) > b > Point > b #  
Transformable Point #  Just apply the function 
PlaneBoundable Point #  
Defined in Graphics.Rasterific.PlaneBoundable planeBounds :: Point > PlaneBound #  
Eq a => Eq (V2 a) #  
Num a => Num (V2 a) #  
Show a => Show (V2 a) #  
Epsilon a => Epsilon (V2 a) #  
Defined in Graphics.Rasterific.Linear 
A 3dimensional vector
V3 !a !a !a 
Instances
Functor V3 #  
Applicative V3 #  
Foldable V3 #  
Defined in Graphics.Rasterific.Linear fold :: Monoid m => V3 m > 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 #  
Metric V3 #  
Additive V3 #  
R2 V3 #  
Defined in Graphics.Rasterific.Linear  
R1 V3 #  
Defined in Graphics.Rasterific.Linear  
Eq a => Eq (V3 a) #  
Num a => Num (V3 a) #  
Show a => Show (V3 a) #  
Epsilon a => Epsilon (V3 a) #  
Defined in Graphics.Rasterific.Linear 
A 4dimensional vector
V4 !a !a !a !a 
Instances
Functor V4 #  
Applicative V4 #  
Foldable V4 #  
Defined in Graphics.Rasterific.Linear fold :: Monoid m => V4 m > m # foldMap :: Monoid m => (a > m) > V4 a > m # foldr :: (a > b > b) > b > V4 a > b # foldr' :: (a > b > b) > b > V4 a > b # foldl :: (b > a > b) > b > V4 a > b # foldl' :: (b > a > b) > b > V4 a > b # foldr1 :: (a > a > a) > V4 a > a # foldl1 :: (a > a > a) > V4 a > a # elem :: Eq a => a > V4 a > Bool # maximum :: Ord a => V4 a > a #  
Traversable V4 #  
Metric V4 #  
Additive V4 #  
R2 V4 #  
Defined in Graphics.Rasterific.Linear  
R1 V4 #  
Defined in Graphics.Rasterific.Linear  
Eq a => Eq (V4 a) #  
Num a => Num (V4 a) #  
Show a => Show (V4 a) #  
Epsilon a => Epsilon (V4 a) #  
Defined in Graphics.Rasterific.Linear 
class Functor f => Additive f where #
A vector is an additive group with additional structure.
The zero vector
(^+^) :: Num a => f a > f a > f a infixl 6 #
Compute the sum of two vectors
>>>
V2 1 2 ^+^ V2 3 4
V2 4 6
(^^) :: Num a => f a > f a > f a infixl 6 #
Compute the difference between two vectors
>>>
V2 4 5  V2 3 1
V2 1 4
lerp :: Num a => a > f a > f a > f a #
Linearly interpolate between two vectors.
class Num a => Epsilon a where #
Provides a fairly subjective test to see if a quantity is near zero.
>>>
nearZero (1e11 :: Double)
False
>>>
nearZero (1e17 :: Double)
True
>>>
nearZero (1e5 :: Float)
False
>>>
nearZero (1e7 :: Float)
True
Instances
Epsilon Double # 

Defined in Graphics.Rasterific.Linear  
Epsilon Float # 

Defined in Graphics.Rasterific.Linear  
Epsilon a => Epsilon (V1 a) #  
Defined in Graphics.Rasterific.Linear  
Epsilon a => Epsilon (V4 a) #  
Defined in Graphics.Rasterific.Linear  
Epsilon a => Epsilon (V3 a) #  
Defined in Graphics.Rasterific.Linear  
Epsilon a => Epsilon (V2 a) #  
Defined in Graphics.Rasterific.Linear 
class Additive f => Metric f where #
Free and sparse inner product/metric spaces.
dot :: Num a => f a > f a > a #
Compute the inner product of two vectors or (equivalently)
convert a vector f a
into a covector f a > a
.
>>>
V2 1 2 `dot` V2 3 4
11
quadrance :: Num a => f a > a #
Compute the squared norm. The name quadrance arises from Norman J. Wildberger's rational trigonometry.
qd :: Num a => f a > f a > a #
Compute the quadrance of the difference
distance :: Floating a => f a > f a > a #
Compute the distance between two vectors in a metric space
norm :: Floating a => f a > a #
Compute the norm of a vector in a metric space
signorm :: Floating a => f a > f a #
Convert a nonzero vector to unit vector.
(^*) :: (Functor f, Num a) => f a > a > f a infixl 7 #
Compute the right scalar product
>>>
V2 3 4 ^* 2
V2 6 8