| License | BSD-style (see the file LICENSE) |
|---|---|
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | Trustworthy |
| Language | Haskell98 |
Linear.Affine
Description
Operations on affine spaces.
- class Additive (Diff p) => Affine p where
- qdA :: (Affine p, Foldable (Diff p), Num a) => p a -> p a -> a
- distanceA :: (Floating a, Foldable (Diff p), Affine p) => p a -> p a -> a
- newtype Point f a = P (f a)
- lensP :: Lens' (Point g a) (g a)
- _Point :: Iso' (Point f a) (f a)
- origin :: (Additive f, Num a) => Point f a
- relative :: (Additive f, Num a) => Point f a -> Iso' (Point f a) (f a)
Documentation
class Additive (Diff p) => Affine p where Source
An affine space is roughly a vector space in which we have forgotten or at least pretend to have forgotten the origin.
a .+^ (b .-. a) = b@ (a .+^ u) .+^ v = a .+^ (u ^+^ v)@ (a .-. b) ^+^ v = (a .+^ v) .-. q@
Methods
(.-.) :: Num a => p a -> p a -> Diff p a infixl 6 Source
Get the difference between two points as a vector offset.
(.+^) :: Num a => p a -> Diff p a -> p a infixl 6 Source
Add a vector offset to a point.
(.-^) :: Num a => p a -> Diff p a -> p a infixl 6 Source
Subtract a vector offset from a point.
Instances
| Affine [] | |
| Affine Complex | |
| Affine ZipList | |
| Affine Maybe | |
| Affine Identity | |
| Affine IntMap | |
| Affine Vector | |
| Affine V0 | |
| Affine V1 | |
| Affine V2 | |
| Affine V3 | |
| Affine V4 | |
| Affine Plucker | |
| Affine Quaternion | |
| Affine ((->) b) | |
| Ord k => Affine (Map k) | |
| (Eq k, Hashable k) => Affine (HashMap k) | |
| Additive f => Affine (Point f) | |
| Dim * n => Affine (V * n) |
qdA :: (Affine p, Foldable (Diff p), Num a) => p a -> p a -> a Source
Compute the quadrance of the difference (the square of the distance)
distanceA :: (Floating a, Foldable (Diff p), Affine p) => p a -> p a -> a Source
Distance between two points in an affine space
A handy wrapper to help distinguish points from vectors at the type level
Constructors
| P (f a) |
Instances