{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveLift #-}
#ifndef MIN_VERSION_vector
#define MIN_VERSION_vector(x,y,z) 1
#endif
#ifndef MIN_VERSION_transformers
#define MIN_VERSION_transformers(x,y,z) 1
#endif
module Linear.Plucker
( Plucker(..)
, squaredError
, isotropic
, (><)
, plucker
, plucker3D
, parallel
, intersects
, LinePass(..)
, passes
, quadranceToOrigin
, closestToOrigin
, isLine
, coincides
, coincides'
, p01, p02, p03
, p10, p12, p13
, p20, p21, p23
, p30, p31, p32
, e01, e02, e03, e12, e31, e23
) where
import Control.Applicative
import Control.DeepSeq (NFData(rnf))
import Control.Monad (liftM)
import Control.Monad.Fix
import Control.Monad.Zip
import Control.Lens as Lens hiding (index, (<.>))
import Data.Binary as Binary
import Data.Bytes.Serial
import Data.Distributive
import Data.Foldable as Foldable
import qualified Data.Foldable.WithIndex as WithIndex
import Data.Functor.Bind
import Data.Functor.Classes
import Data.Functor.Rep
import qualified Data.Functor.WithIndex as WithIndex
import Data.Hashable
import Data.Semigroup
import Data.Semigroup.Foldable
import Data.Serialize as Cereal
import qualified Data.Traversable.WithIndex as WithIndex
import qualified Data.Vector as V
import qualified Data.Vector.Generic.Mutable as M
import qualified Data.Vector.Generic as G
import qualified Data.Vector.Unboxed.Base as U
import Foreign.Ptr (castPtr)
import Foreign.Storable (Storable(..))
import GHC.Arr (Ix(..))
import GHC.Generics (Generic, Generic1)
#if defined(MIN_VERSION_template_haskell)
import Language.Haskell.TH.Syntax (Lift)
#endif
import Linear.Epsilon
import Linear.Metric
import Linear.V
import Linear.V2
import Linear.V3
import Linear.V4
import Linear.Vector
import System.Random (Random(..))
data Plucker a = Plucker !a !a !a !a !a !a deriving (Plucker a -> Plucker a -> Bool
forall a. Eq a => Plucker a -> Plucker a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Plucker a -> Plucker a -> Bool
$c/= :: forall a. Eq a => Plucker a -> Plucker a -> Bool
== :: Plucker a -> Plucker a -> Bool
$c== :: forall a. Eq a => Plucker a -> Plucker a -> Bool
Eq,Plucker a -> Plucker a -> Bool
Plucker a -> Plucker a -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Plucker a)
forall a. Ord a => Plucker a -> Plucker a -> Bool
forall a. Ord a => Plucker a -> Plucker a -> Ordering
forall a. Ord a => Plucker a -> Plucker a -> Plucker a
min :: Plucker a -> Plucker a -> Plucker a
$cmin :: forall a. Ord a => Plucker a -> Plucker a -> Plucker a
max :: Plucker a -> Plucker a -> Plucker a
$cmax :: forall a. Ord a => Plucker a -> Plucker a -> Plucker a
>= :: Plucker a -> Plucker a -> Bool
$c>= :: forall a. Ord a => Plucker a -> Plucker a -> Bool
> :: Plucker a -> Plucker a -> Bool
$c> :: forall a. Ord a => Plucker a -> Plucker a -> Bool
<= :: Plucker a -> Plucker a -> Bool
$c<= :: forall a. Ord a => Plucker a -> Plucker a -> Bool
< :: Plucker a -> Plucker a -> Bool
$c< :: forall a. Ord a => Plucker a -> Plucker a -> Bool
compare :: Plucker a -> Plucker a -> Ordering
$ccompare :: forall a. Ord a => Plucker a -> Plucker a -> Ordering
Ord,Int -> Plucker a -> ShowS
forall a. Show a => Int -> Plucker a -> ShowS
forall a. Show a => [Plucker a] -> ShowS
forall a. Show a => Plucker a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Plucker a] -> ShowS
$cshowList :: forall a. Show a => [Plucker a] -> ShowS
show :: Plucker a -> String
$cshow :: forall a. Show a => Plucker a -> String
showsPrec :: Int -> Plucker a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Plucker a -> ShowS
Show,ReadPrec [Plucker a]
ReadPrec (Plucker a)
ReadS [Plucker a]
forall a. Read a => ReadPrec [Plucker a]
forall a. Read a => ReadPrec (Plucker a)
forall a. Read a => Int -> ReadS (Plucker a)
forall a. Read a => ReadS [Plucker a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Plucker a]
$creadListPrec :: forall a. Read a => ReadPrec [Plucker a]
readPrec :: ReadPrec (Plucker a)
$creadPrec :: forall a. Read a => ReadPrec (Plucker a)
readList :: ReadS [Plucker a]
$creadList :: forall a. Read a => ReadS [Plucker a]
readsPrec :: Int -> ReadS (Plucker a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Plucker a)
Read
,forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Plucker a) x -> Plucker a
forall a x. Plucker a -> Rep (Plucker a) x
$cto :: forall a x. Rep (Plucker a) x -> Plucker a
$cfrom :: forall a x. Plucker a -> Rep (Plucker a) x
Generic,forall a. Rep1 Plucker a -> Plucker a
forall a. Plucker a -> Rep1 Plucker a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 Plucker a -> Plucker a
$cfrom1 :: forall a. Plucker a -> Rep1 Plucker a
Generic1
#if defined(MIN_VERSION_template_haskell)
,forall a (m :: * -> *). (Lift a, Quote m) => Plucker a -> m Exp
forall a (m :: * -> *).
(Lift a, Quote m) =>
Plucker a -> Code m (Plucker a)
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => Plucker a -> m Exp
forall (m :: * -> *). Quote m => Plucker a -> Code m (Plucker a)
liftTyped :: forall (m :: * -> *). Quote m => Plucker a -> Code m (Plucker a)
$cliftTyped :: forall a (m :: * -> *).
(Lift a, Quote m) =>
Plucker a -> Code m (Plucker a)
lift :: forall (m :: * -> *). Quote m => Plucker a -> m Exp
$clift :: forall a (m :: * -> *). (Lift a, Quote m) => Plucker a -> m Exp
Lift
#endif
)
instance Finite Plucker where
type Size Plucker = 6
toV :: forall a. Plucker a -> V (Size Plucker) a
toV (Plucker a
a a
b a
c a
d a
e a
f) = forall {k} (n :: k) a. Vector a -> V n a
V (forall a. Int -> [a] -> Vector a
V.fromListN Int
6 [a
a,a
b,a
c,a
d,a
e,a
f])
fromV :: forall a. V (Size Plucker) a -> Plucker a
fromV (V Vector a
v) = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker (Vector a
v forall a. Vector a -> Int -> a
V.! Int
0) (Vector a
v forall a. Vector a -> Int -> a
V.! Int
1) (Vector a
v forall a. Vector a -> Int -> a
V.! Int
2) (Vector a
v forall a. Vector a -> Int -> a
V.! Int
3) (Vector a
v forall a. Vector a -> Int -> a
V.! Int
4) (Vector a
v forall a. Vector a -> Int -> a
V.! Int
5)
instance Random a => Random (Plucker a) where
random :: forall g. RandomGen g => g -> (Plucker a, g)
random g
g = case forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g of
(a
a, g
g1) -> case forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g1 of
(a
b, g
g2) -> case forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g2 of
(a
c, g
g3) -> case forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g3 of
(a
d, g
g4) -> case forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g4 of
(a
e, g
g5) -> case forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g5 of
(a
f, g
g6) -> (forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a a
b a
c a
d a
e a
f, g
g6)
randomR :: forall g.
RandomGen g =>
(Plucker a, Plucker a) -> g -> (Plucker a, g)
randomR (Plucker a
a a
b a
c a
d a
e a
f, Plucker a
a' a
b' a
c' a
d' a
e' a
f') g
g = case forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
a,a
a') g
g of
(a
a'', g
g1) -> case forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
b,a
b') g
g1 of
(a
b'', g
g2) -> case forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
c,a
c') g
g2 of
(a
c'', g
g3) -> case forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
d,a
d') g
g3 of
(a
d'', g
g4) -> case forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
e,a
e') g
g4 of
(a
e'', g
g5) -> case forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
f,a
f') g
g5 of
(a
f'', g
g6) -> (forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a'' a
b'' a
c'' a
d'' a
e'' a
f'', g
g6)
instance Functor Plucker where
fmap :: forall a b. (a -> b) -> Plucker a -> Plucker b
fmap a -> b
g (Plucker a
a a
b a
c a
d a
e a
f) = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker (a -> b
g a
a) (a -> b
g a
b) (a -> b
g a
c) (a -> b
g a
d) (a -> b
g a
e) (a -> b
g a
f)
{-# INLINE fmap #-}
instance Apply Plucker where
Plucker a -> b
a a -> b
b a -> b
c a -> b
d a -> b
e a -> b
f <.> :: forall a b. Plucker (a -> b) -> Plucker a -> Plucker b
<.> Plucker a
g a
h a
i a
j a
k a
l =
forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker (a -> b
a a
g) (a -> b
b a
h) (a -> b
c a
i) (a -> b
d a
j) (a -> b
e a
k) (a -> b
f a
l)
{-# INLINE (<.>) #-}
instance Applicative Plucker where
pure :: forall a. a -> Plucker a
pure a
a = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a a
a a
a a
a a
a a
a
{-# INLINE pure #-}
Plucker a -> b
a a -> b
b a -> b
c a -> b
d a -> b
e a -> b
f <*> :: forall a b. Plucker (a -> b) -> Plucker a -> Plucker b
<*> Plucker a
g a
h a
i a
j a
k a
l =
forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker (a -> b
a a
g) (a -> b
b a
h) (a -> b
c a
i) (a -> b
d a
j) (a -> b
e a
k) (a -> b
f a
l)
{-# INLINE (<*>) #-}
instance Additive Plucker where
zero :: forall a. Num a => Plucker a
zero = forall (f :: * -> *) a. Applicative f => a -> f a
pure a
0
{-# INLINE zero #-}
liftU2 :: forall a. (a -> a -> a) -> Plucker a -> Plucker a -> Plucker a
liftU2 = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2
{-# INLINE liftU2 #-}
liftI2 :: forall a b c. (a -> b -> c) -> Plucker a -> Plucker b -> Plucker c
liftI2 = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2
{-# INLINE liftI2 #-}
instance Bind Plucker where
Plucker a
a a
b a
c a
d a
e a
f >>- :: forall a b. Plucker a -> (a -> Plucker b) -> Plucker b
>>- a -> Plucker b
g = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker b
a' b
b' b
c' b
d' b
e' b
f' where
Plucker b
a' b
_ b
_ b
_ b
_ b
_ = a -> Plucker b
g a
a
Plucker b
_ b
b' b
_ b
_ b
_ b
_ = a -> Plucker b
g a
b
Plucker b
_ b
_ b
c' b
_ b
_ b
_ = a -> Plucker b
g a
c
Plucker b
_ b
_ b
_ b
d' b
_ b
_ = a -> Plucker b
g a
d
Plucker b
_ b
_ b
_ b
_ b
e' b
_ = a -> Plucker b
g a
e
Plucker b
_ b
_ b
_ b
_ b
_ b
f' = a -> Plucker b
g a
f
{-# INLINE (>>-) #-}
instance Monad Plucker where
#if !(MIN_VERSION_base(4,11,0))
return a = Plucker a a a a a a
{-# INLINE return #-}
#endif
Plucker a
a a
b a
c a
d a
e a
f >>= :: forall a b. Plucker a -> (a -> Plucker b) -> Plucker b
>>= a -> Plucker b
g = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker b
a' b
b' b
c' b
d' b
e' b
f' where
Plucker b
a' b
_ b
_ b
_ b
_ b
_ = a -> Plucker b
g a
a
Plucker b
_ b
b' b
_ b
_ b
_ b
_ = a -> Plucker b
g a
b
Plucker b
_ b
_ b
c' b
_ b
_ b
_ = a -> Plucker b
g a
c
Plucker b
_ b
_ b
_ b
d' b
_ b
_ = a -> Plucker b
g a
d
Plucker b
_ b
_ b
_ b
_ b
e' b
_ = a -> Plucker b
g a
e
Plucker b
_ b
_ b
_ b
_ b
_ b
f' = a -> Plucker b
g a
f
{-# INLINE (>>=) #-}
instance Distributive Plucker where
distribute :: forall (f :: * -> *) a. Functor f => f (Plucker a) -> Plucker (f a)
distribute f (Plucker a)
f = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(Plucker a
x a
_ a
_ a
_ a
_ a
_) -> a
x) f (Plucker a)
f)
(forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(Plucker a
_ a
x a
_ a
_ a
_ a
_) -> a
x) f (Plucker a)
f)
(forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(Plucker a
_ a
_ a
x a
_ a
_ a
_) -> a
x) f (Plucker a)
f)
(forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(Plucker a
_ a
_ a
_ a
x a
_ a
_) -> a
x) f (Plucker a)
f)
(forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(Plucker a
_ a
_ a
_ a
_ a
x a
_) -> a
x) f (Plucker a)
f)
(forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(Plucker a
_ a
_ a
_ a
_ a
_ a
x) -> a
x) f (Plucker a)
f)
{-# INLINE distribute #-}
instance Representable Plucker where
type Rep Plucker = E Plucker
tabulate :: forall a. (Rep Plucker -> a) -> Plucker a
tabulate Rep Plucker -> a
f = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker (Rep Plucker -> a
f E Plucker
e01) (Rep Plucker -> a
f E Plucker
e02) (Rep Plucker -> a
f E Plucker
e03) (Rep Plucker -> a
f E Plucker
e23) (Rep Plucker -> a
f E Plucker
e31) (Rep Plucker -> a
f E Plucker
e12)
{-# INLINE tabulate #-}
index :: forall a. Plucker a -> Rep Plucker -> a
index Plucker a
xs (E forall x. Lens' (Plucker x) x
l) = forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall x. Lens' (Plucker x) x
l Plucker a
xs
{-# INLINE index #-}
instance Foldable Plucker where
foldMap :: forall m a. Monoid m => (a -> m) -> Plucker a -> m
foldMap a -> m
g (Plucker a
a a
b a
c a
d a
e a
f) =
a -> m
g a
a forall a. Monoid a => a -> a -> a
`mappend` a -> m
g a
b forall a. Monoid a => a -> a -> a
`mappend` a -> m
g a
c forall a. Monoid a => a -> a -> a
`mappend` a -> m
g a
d forall a. Monoid a => a -> a -> a
`mappend` a -> m
g a
e forall a. Monoid a => a -> a -> a
`mappend` a -> m
g a
f
{-# INLINE foldMap #-}
null :: forall a. Plucker a -> Bool
null Plucker a
_ = Bool
False
length :: forall a. Plucker a -> Int
length Plucker a
_ = Int
6
instance Traversable Plucker where
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Plucker a -> f (Plucker b)
traverse a -> f b
g (Plucker a
a a
b a
c a
d a
e a
f) =
forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
g a
a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
g a
b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
g a
c forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
g a
d forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
g a
e forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
g a
f
{-# INLINE traverse #-}
instance Foldable1 Plucker where
foldMap1 :: forall m a. Semigroup m => (a -> m) -> Plucker a -> m
foldMap1 a -> m
g (Plucker a
a a
b a
c a
d a
e a
f) =
a -> m
g a
a forall a. Semigroup a => a -> a -> a
<> a -> m
g a
b forall a. Semigroup a => a -> a -> a
<> a -> m
g a
c forall a. Semigroup a => a -> a -> a
<> a -> m
g a
d forall a. Semigroup a => a -> a -> a
<> a -> m
g a
e forall a. Semigroup a => a -> a -> a
<> a -> m
g a
f
{-# INLINE foldMap1 #-}
instance Traversable1 Plucker where
traverse1 :: forall (f :: * -> *) a b.
Apply f =>
(a -> f b) -> Plucker a -> f (Plucker b)
traverse1 a -> f b
g (Plucker a
a a
b a
c a
d a
e a
f) =
forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
g a
a forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> a -> f b
g a
b forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> a -> f b
g a
c forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> a -> f b
g a
d forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> a -> f b
g a
e forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> a -> f b
g a
f
{-# INLINE traverse1 #-}
instance Ix a => Ix (Plucker a) where
range :: (Plucker a, Plucker a) -> [Plucker a]
range (Plucker a
l1 a
l2 a
l3 a
l4 a
l5 a
l6,Plucker a
u1 a
u2 a
u3 a
u4 a
u5 a
u6) =
[forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
i1 a
i2 a
i3 a
i4 a
i5 a
i6 | a
i1 <- forall a. Ix a => (a, a) -> [a]
range (a
l1,a
u1)
, a
i2 <- forall a. Ix a => (a, a) -> [a]
range (a
l2,a
u2)
, a
i3 <- forall a. Ix a => (a, a) -> [a]
range (a
l3,a
u3)
, a
i4 <- forall a. Ix a => (a, a) -> [a]
range (a
l4,a
u4)
, a
i5 <- forall a. Ix a => (a, a) -> [a]
range (a
l5,a
u5)
, a
i6 <- forall a. Ix a => (a, a) -> [a]
range (a
l6,a
u6)
]
{-# INLINE range #-}
unsafeIndex :: (Plucker a, Plucker a) -> Plucker a -> Int
unsafeIndex (Plucker a
l1 a
l2 a
l3 a
l4 a
l5 a
l6,Plucker a
u1 a
u2 a
u3 a
u4 a
u5 a
u6) (Plucker a
i1 a
i2 a
i3 a
i4 a
i5 a
i6) =
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l6,a
u6) a
i6 forall a. Num a => a -> a -> a
+ forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l6,a
u6) forall a. Num a => a -> a -> a
* (
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l5,a
u5) a
i5 forall a. Num a => a -> a -> a
+ forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l5,a
u5) forall a. Num a => a -> a -> a
* (
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l4,a
u4) a
i4 forall a. Num a => a -> a -> a
+ forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l4,a
u4) forall a. Num a => a -> a -> a
* (
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l3,a
u3) a
i3 forall a. Num a => a -> a -> a
+ forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l3,a
u3) forall a. Num a => a -> a -> a
* (
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l2,a
u2) a
i2 forall a. Num a => a -> a -> a
+ forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l2,a
u2) forall a. Num a => a -> a -> a
*
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l1,a
u1) a
i1))))
{-# INLINE unsafeIndex #-}
inRange :: (Plucker a, Plucker a) -> Plucker a -> Bool
inRange (Plucker a
l1 a
l2 a
l3 a
l4 a
l5 a
l6,Plucker a
u1 a
u2 a
u3 a
u4 a
u5 a
u6) (Plucker a
i1 a
i2 a
i3 a
i4 a
i5 a
i6) =
forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l1,a
u1) a
i1 Bool -> Bool -> Bool
&& forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l2,a
u2) a
i2 Bool -> Bool -> Bool
&&
forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l3,a
u3) a
i3 Bool -> Bool -> Bool
&& forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l4,a
u4) a
i4 Bool -> Bool -> Bool
&&
forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l5,a
u5) a
i5 Bool -> Bool -> Bool
&& forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l6,a
u6) a
i6
{-# INLINE inRange #-}
instance Num a => Num (Plucker a) where
+ :: Plucker a -> Plucker a -> Plucker a
(+) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Num a => a -> a -> a
(+)
{-# INLINE (+) #-}
(-) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (-)
{-# INLINE (-) #-}
* :: Plucker a -> Plucker a -> Plucker a
(*) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Num a => a -> a -> a
(*)
{-# INLINE (*) #-}
negate :: Plucker a -> Plucker a
negate = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Num a => a -> a
negate
{-# INLINE negate #-}
abs :: Plucker a -> Plucker a
abs = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Num a => a -> a
abs
{-# INLINE abs #-}
signum :: Plucker a -> Plucker a
signum = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Num a => a -> a
signum
{-# INLINE signum #-}
fromInteger :: Integer -> Plucker a
fromInteger = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger
{-# INLINE fromInteger #-}
instance Fractional a => Fractional (Plucker a) where
recip :: Plucker a -> Plucker a
recip = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Fractional a => a -> a
recip
{-# INLINE recip #-}
/ :: Plucker a -> Plucker a -> Plucker a
(/) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Fractional a => a -> a -> a
(/)
{-# INLINE (/) #-}
fromRational :: Rational -> Plucker a
fromRational = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Fractional a => Rational -> a
fromRational
{-# INLINE fromRational #-}
instance Floating a => Floating (Plucker a) where
pi :: Plucker a
pi = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Floating a => a
pi
{-# INLINE pi #-}
exp :: Plucker a -> Plucker a
exp = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
exp
{-# INLINE exp #-}
sqrt :: Plucker a -> Plucker a
sqrt = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
sqrt
{-# INLINE sqrt #-}
log :: Plucker a -> Plucker a
log = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
log
{-# INLINE log #-}
** :: Plucker a -> Plucker a -> Plucker a
(**) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Floating a => a -> a -> a
(**)
{-# INLINE (**) #-}
logBase :: Plucker a -> Plucker a -> Plucker a
logBase = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Floating a => a -> a -> a
logBase
{-# INLINE logBase #-}
sin :: Plucker a -> Plucker a
sin = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
sin
{-# INLINE sin #-}
tan :: Plucker a -> Plucker a
tan = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
tan
{-# INLINE tan #-}
cos :: Plucker a -> Plucker a
cos = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
cos
{-# INLINE cos #-}
asin :: Plucker a -> Plucker a
asin = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
asin
{-# INLINE asin #-}
atan :: Plucker a -> Plucker a
atan = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
atan
{-# INLINE atan #-}
acos :: Plucker a -> Plucker a
acos = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
acos
{-# INLINE acos #-}
sinh :: Plucker a -> Plucker a
sinh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
sinh
{-# INLINE sinh #-}
tanh :: Plucker a -> Plucker a
tanh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
tanh
{-# INLINE tanh #-}
cosh :: Plucker a -> Plucker a
cosh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
cosh
{-# INLINE cosh #-}
asinh :: Plucker a -> Plucker a
asinh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
asinh
{-# INLINE asinh #-}
atanh :: Plucker a -> Plucker a
atanh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
atanh
{-# INLINE atanh #-}
acosh :: Plucker a -> Plucker a
acosh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
acosh
{-# INLINE acosh #-}
instance Hashable a => Hashable (Plucker a) where
hashWithSalt :: Int -> Plucker a -> Int
hashWithSalt Int
s (Plucker a
a a
b a
c a
d a
e a
f) = Int
s forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
a forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
b forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
c forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
d forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
e forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
f
{-# INLINE hashWithSalt #-}
instance Storable a => Storable (Plucker a) where
sizeOf :: Plucker a -> Int
sizeOf Plucker a
_ = Int
6 forall a. Num a => a -> a -> a
* forall a. Storable a => a -> Int
sizeOf (forall a. HasCallStack => a
undefined::a)
{-# INLINE sizeOf #-}
alignment :: Plucker a -> Int
alignment Plucker a
_ = forall a. Storable a => a -> Int
alignment (forall a. HasCallStack => a
undefined::a)
{-# INLINE alignment #-}
poke :: Ptr (Plucker a) -> Plucker a -> IO ()
poke Ptr (Plucker a)
ptr (Plucker a
a a
b a
c a
d a
e a
f) = do
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr a
ptr' a
a
forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
1 a
b
forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
2 a
c
forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
3 a
d
forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
4 a
e
forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
5 a
f
where ptr' :: Ptr a
ptr' = forall a b. Ptr a -> Ptr b
castPtr Ptr (Plucker a)
ptr
{-# INLINE poke #-}
peek :: Ptr (Plucker a) -> IO (Plucker a)
peek Ptr (Plucker a)
ptr = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Storable a => Ptr a -> IO a
peek Ptr a
ptr'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
1
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
2
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
3
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
4
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
5
where ptr' :: Ptr a
ptr' = forall a b. Ptr a -> Ptr b
castPtr Ptr (Plucker a)
ptr
{-# INLINE peek #-}
instance Metric Plucker where
dot :: forall a. Num a => Plucker a -> Plucker a -> a
dot (Plucker a
a a
b a
c a
d a
e a
f) (Plucker a
g a
h a
i a
j a
k a
l) = a
aforall a. Num a => a -> a -> a
*a
gforall a. Num a => a -> a -> a
+a
bforall a. Num a => a -> a -> a
*a
hforall a. Num a => a -> a -> a
+a
cforall a. Num a => a -> a -> a
*a
iforall a. Num a => a -> a -> a
+a
dforall a. Num a => a -> a -> a
*a
jforall a. Num a => a -> a -> a
+a
eforall a. Num a => a -> a -> a
*a
kforall a. Num a => a -> a -> a
+a
fforall a. Num a => a -> a -> a
*a
l
{-# INLINE dot #-}
instance Epsilon a => Epsilon (Plucker a) where
nearZero :: Plucker a -> Bool
nearZero = forall a. Epsilon a => a -> Bool
nearZero forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a. (Metric f, Num a) => f a -> a
quadrance
{-# INLINE nearZero #-}
plucker :: Num a => V4 a -> V4 a -> Plucker a
plucker :: forall a. Num a => V4 a -> V4 a -> Plucker a
plucker (V4 a
a a
b a
c a
d)
(V4 a
e a
f a
g a
h) =
forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker (a
aforall a. Num a => a -> a -> a
*a
fforall a. Num a => a -> a -> a
-a
bforall a. Num a => a -> a -> a
*a
e)
(a
aforall a. Num a => a -> a -> a
*a
gforall a. Num a => a -> a -> a
-a
cforall a. Num a => a -> a -> a
*a
e)
(a
bforall a. Num a => a -> a -> a
*a
gforall a. Num a => a -> a -> a
-a
cforall a. Num a => a -> a -> a
*a
f)
(a
aforall a. Num a => a -> a -> a
*a
hforall a. Num a => a -> a -> a
-a
dforall a. Num a => a -> a -> a
*a
e)
(a
bforall a. Num a => a -> a -> a
*a
hforall a. Num a => a -> a -> a
-a
dforall a. Num a => a -> a -> a
*a
f)
(a
cforall a. Num a => a -> a -> a
*a
hforall a. Num a => a -> a -> a
-a
dforall a. Num a => a -> a -> a
*a
g)
{-# INLINE plucker #-}
plucker3D :: Num a => V3 a -> V3 a -> Plucker a
plucker3D :: forall a. Num a => V3 a -> V3 a -> Plucker a
plucker3D V3 a
p V3 a
q = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a a
b a
c a
d a
e a
f
where V3 a
a a
b a
c = V3 a
p forall a. Num a => a -> a -> a
- V3 a
q
V3 a
d a
e a
f = V3 a
p forall a. Num a => V3 a -> V3 a -> V3 a
`cross` V3 a
q
p01, p02, p03, p23, p31, p12 :: Lens' (Plucker a) a
p01 :: forall x. Lens' (Plucker x) x
p01 a -> f a
g (Plucker a
a a
b a
c a
d a
e a
f) = (\a
a' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a' a
b a
c a
d a
e a
f) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
g a
a
p02 :: forall x. Lens' (Plucker x) x
p02 a -> f a
g (Plucker a
a a
b a
c a
d a
e a
f) = (\a
b' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a a
b' a
c a
d a
e a
f) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
g a
b
p03 :: forall x. Lens' (Plucker x) x
p03 a -> f a
g (Plucker a
a a
b a
c a
d a
e a
f) = (\a
c' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a a
b a
c' a
d a
e a
f) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
g a
c
p23 :: forall x. Lens' (Plucker x) x
p23 a -> f a
g (Plucker a
a a
b a
c a
d a
e a
f) = (\a
d' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a a
b a
c a
d' a
e a
f) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
g a
d
p31 :: forall x. Lens' (Plucker x) x
p31 a -> f a
g (Plucker a
a a
b a
c a
d a
e a
f) = (\a
e' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a a
b a
c a
d a
e' a
f) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
g a
e
p12 :: forall x. Lens' (Plucker x) x
p12 a -> f a
g (Plucker a
a a
b a
c a
d a
e a
f) = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a a
b a
c a
d a
e forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
g a
f
{-# INLINE p01 #-}
{-# INLINE p02 #-}
{-# INLINE p03 #-}
{-# INLINE p23 #-}
{-# INLINE p31 #-}
{-# INLINE p12 #-}
p10, p20, p30, p32, p13, p21 :: (Functor f, Num a) => (a -> f a) -> Plucker a -> f (Plucker a)
p10 :: forall (f :: * -> *) a.
(Functor f, Num a) =>
(a -> f a) -> Plucker a -> f (Plucker a)
p10 = forall (f :: * -> *) a r.
(Functor f, Num a) =>
((a -> f a) -> r) -> (a -> f a) -> r
anti forall x. Lens' (Plucker x) x
p01
p20 :: forall (f :: * -> *) a.
(Functor f, Num a) =>
(a -> f a) -> Plucker a -> f (Plucker a)
p20 = forall (f :: * -> *) a r.
(Functor f, Num a) =>
((a -> f a) -> r) -> (a -> f a) -> r
anti forall x. Lens' (Plucker x) x
p02
p30 :: forall (f :: * -> *) a.
(Functor f, Num a) =>
(a -> f a) -> Plucker a -> f (Plucker a)
p30 = forall (f :: * -> *) a r.
(Functor f, Num a) =>
((a -> f a) -> r) -> (a -> f a) -> r
anti forall x. Lens' (Plucker x) x
p03
p32 :: forall (f :: * -> *) a.
(Functor f, Num a) =>
(a -> f a) -> Plucker a -> f (Plucker a)
p32 = forall (f :: * -> *) a r.
(Functor f, Num a) =>
((a -> f a) -> r) -> (a -> f a) -> r
anti forall x. Lens' (Plucker x) x
p23
p13 :: forall (f :: * -> *) a.
(Functor f, Num a) =>
(a -> f a) -> Plucker a -> f (Plucker a)
p13 = forall (f :: * -> *) a r.
(Functor f, Num a) =>
((a -> f a) -> r) -> (a -> f a) -> r
anti forall x. Lens' (Plucker x) x
p31
p21 :: forall (f :: * -> *) a.
(Functor f, Num a) =>
(a -> f a) -> Plucker a -> f (Plucker a)
p21 = forall (f :: * -> *) a r.
(Functor f, Num a) =>
((a -> f a) -> r) -> (a -> f a) -> r
anti forall (f :: * -> *) a.
(Functor f, Num a) =>
(a -> f a) -> Plucker a -> f (Plucker a)
p21
{-# INLINE p10 #-}
{-# INLINE p20 #-}
{-# INLINE p30 #-}
{-# INLINE p32 #-}
{-# INLINE p13 #-}
{-# INLINE p21 #-}
anti :: (Functor f, Num a) => ((a -> f a) -> r) -> (a -> f a) -> r
anti :: forall (f :: * -> *) a r.
(Functor f, Num a) =>
((a -> f a) -> r) -> (a -> f a) -> r
anti (a -> f a) -> r
k a -> f a
f = (a -> f a) -> r
k (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Num a => a -> a
negate forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> f a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => a -> a
negate)
e01, e02, e03, e23, e31, e12 :: E Plucker
e01 :: E Plucker
e01 = forall (t :: * -> *). (forall x. Lens' (t x) x) -> E t
E forall x. Lens' (Plucker x) x
p01
e02 :: E Plucker
e02 = forall (t :: * -> *). (forall x. Lens' (t x) x) -> E t
E forall x. Lens' (Plucker x) x
p02
e03 :: E Plucker
e03 = forall (t :: * -> *). (forall x. Lens' (t x) x) -> E t
E forall x. Lens' (Plucker x) x
p03
e23 :: E Plucker
e23 = forall (t :: * -> *). (forall x. Lens' (t x) x) -> E t
E forall x. Lens' (Plucker x) x
p23
e31 :: E Plucker
e31 = forall (t :: * -> *). (forall x. Lens' (t x) x) -> E t
E forall x. Lens' (Plucker x) x
p31
e12 :: E Plucker
e12 = forall (t :: * -> *). (forall x. Lens' (t x) x) -> E t
E forall x. Lens' (Plucker x) x
p12
instance WithIndex.FunctorWithIndex (E Plucker) Plucker where
imap :: forall a b. (E Plucker -> a -> b) -> Plucker a -> Plucker b
imap E Plucker -> a -> b
f (Plucker a
a a
b a
c a
d a
e a
g) = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker (E Plucker -> a -> b
f E Plucker
e01 a
a) (E Plucker -> a -> b
f E Plucker
e02 a
b) (E Plucker -> a -> b
f E Plucker
e03 a
c) (E Plucker -> a -> b
f E Plucker
e23 a
d) (E Plucker -> a -> b
f E Plucker
e31 a
e) (E Plucker -> a -> b
f E Plucker
e12 a
g)
{-# INLINE imap #-}
instance WithIndex.FoldableWithIndex (E Plucker) Plucker where
ifoldMap :: forall m a. Monoid m => (E Plucker -> a -> m) -> Plucker a -> m
ifoldMap E Plucker -> a -> m
f (Plucker a
a a
b a
c a
d a
e a
g) = E Plucker -> a -> m
f E Plucker
e01 a
a forall a. Monoid a => a -> a -> a
`mappend` E Plucker -> a -> m
f E Plucker
e02 a
b forall a. Monoid a => a -> a -> a
`mappend` E Plucker -> a -> m
f E Plucker
e03 a
c
forall a. Monoid a => a -> a -> a
`mappend` E Plucker -> a -> m
f E Plucker
e23 a
d forall a. Monoid a => a -> a -> a
`mappend` E Plucker -> a -> m
f E Plucker
e31 a
e forall a. Monoid a => a -> a -> a
`mappend` E Plucker -> a -> m
f E Plucker
e12 a
g
{-# INLINE ifoldMap #-}
instance WithIndex.TraversableWithIndex (E Plucker) Plucker where
itraverse :: forall (f :: * -> *) a b.
Applicative f =>
(E Plucker -> a -> f b) -> Plucker a -> f (Plucker b)
itraverse E Plucker -> a -> f b
f (Plucker a
a a
b a
c a
d a
e a
g) = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> E Plucker -> a -> f b
f E Plucker
e01 a
a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E Plucker -> a -> f b
f E Plucker
e02 a
b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E Plucker -> a -> f b
f E Plucker
e03 a
c
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E Plucker -> a -> f b
f E Plucker
e23 a
d forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E Plucker -> a -> f b
f E Plucker
e31 a
e forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E Plucker -> a -> f b
f E Plucker
e12 a
g
{-# INLINE itraverse #-}
#if !MIN_VERSION_lens(5,0,0)
instance Lens.FunctorWithIndex (E Plucker) Plucker where imap = WithIndex.imap
instance Lens.FoldableWithIndex (E Plucker) Plucker where ifoldMap = WithIndex.ifoldMap
instance Lens.TraversableWithIndex (E Plucker) Plucker where itraverse = WithIndex.itraverse
#endif
type instance Index (Plucker a) = E Plucker
type instance IxValue (Plucker a) = a
instance Ixed (Plucker a) where
ix :: Index (Plucker a) -> Traversal' (Plucker a) (IxValue (Plucker a))
ix Index (Plucker a)
i = forall (t :: * -> *). E t -> forall x. Lens' (t x) x
el Index (Plucker a)
i
{-# INLINE ix #-}
instance Each (Plucker a) (Plucker b) a b where
each :: Traversal (Plucker a) (Plucker b) a b
each = forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse
{-# INLINE each #-}
squaredError :: Num a => Plucker a -> a
squaredError :: forall a. Num a => Plucker a -> a
squaredError Plucker a
v = Plucker a
v forall a. Num a => Plucker a -> Plucker a -> a
>< Plucker a
v
{-# INLINE squaredError #-}
infixl 5 ><
(><) :: Num a => Plucker a -> Plucker a -> a
Plucker a
a a
b a
c a
d a
e a
f >< :: forall a. Num a => Plucker a -> Plucker a -> a
>< Plucker a
g a
h a
i a
j a
k a
l = a
aforall a. Num a => a -> a -> a
*a
lforall a. Num a => a -> a -> a
-a
bforall a. Num a => a -> a -> a
*a
kforall a. Num a => a -> a -> a
+a
cforall a. Num a => a -> a -> a
*a
jforall a. Num a => a -> a -> a
+a
dforall a. Num a => a -> a -> a
*a
iforall a. Num a => a -> a -> a
-a
eforall a. Num a => a -> a -> a
*a
hforall a. Num a => a -> a -> a
+a
fforall a. Num a => a -> a -> a
*a
g
{-# INLINE (><) #-}
isotropic :: Epsilon a => Plucker a -> Bool
isotropic :: forall a. Epsilon a => Plucker a -> Bool
isotropic Plucker a
a = forall a. Epsilon a => a -> Bool
nearZero (Plucker a
a forall a. Num a => Plucker a -> Plucker a -> a
>< Plucker a
a)
{-# INLINE isotropic #-}
intersects :: (Epsilon a, Ord a) => Plucker a -> Plucker a -> Bool
intersects :: forall a. (Epsilon a, Ord a) => Plucker a -> Plucker a -> Bool
intersects Plucker a
a Plucker a
b = Bool -> Bool
not (Plucker a
a forall a. Epsilon a => Plucker a -> Plucker a -> Bool
`parallel` Plucker a
b) Bool -> Bool -> Bool
&& forall a. (Epsilon a, Ord a) => Plucker a -> Plucker a -> LinePass
passes Plucker a
a Plucker a
b forall a. Eq a => a -> a -> Bool
== LinePass
Coplanar
{-# INLINE intersects #-}
data LinePass = Coplanar
| Clockwise
| Counterclockwise
deriving (LinePass -> LinePass -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LinePass -> LinePass -> Bool
$c/= :: LinePass -> LinePass -> Bool
== :: LinePass -> LinePass -> Bool
$c== :: LinePass -> LinePass -> Bool
Eq, Int -> LinePass -> ShowS
[LinePass] -> ShowS
LinePass -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LinePass] -> ShowS
$cshowList :: [LinePass] -> ShowS
show :: LinePass -> String
$cshow :: LinePass -> String
showsPrec :: Int -> LinePass -> ShowS
$cshowsPrec :: Int -> LinePass -> ShowS
Show,forall x. Rep LinePass x -> LinePass
forall x. LinePass -> Rep LinePass x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LinePass x -> LinePass
$cfrom :: forall x. LinePass -> Rep LinePass x
Generic)
passes :: (Epsilon a, Ord a) => Plucker a -> Plucker a -> LinePass
passes :: forall a. (Epsilon a, Ord a) => Plucker a -> Plucker a -> LinePass
passes Plucker a
a Plucker a
b
| forall a. Epsilon a => a -> Bool
nearZero a
s = LinePass
Coplanar
| a
s forall a. Ord a => a -> a -> Bool
> a
0 = LinePass
Counterclockwise
| Bool
otherwise = LinePass
Clockwise
where s :: a
s = (V3 a
u1 forall (f :: * -> *) a. (Metric f, Num a) => f a -> f a -> a
`dot` V3 a
v2) forall a. Num a => a -> a -> a
+ (V3 a
u2 forall (f :: * -> *) a. (Metric f, Num a) => f a -> f a -> a
`dot` V3 a
v1)
V2 V3 a
u1 V3 a
v1 = forall a. Plucker a -> V2 (V3 a)
toUV Plucker a
a
V2 V3 a
u2 V3 a
v2 = forall a. Plucker a -> V2 (V3 a)
toUV Plucker a
b
{-# INLINE passes #-}
parallel :: Epsilon a => Plucker a -> Plucker a -> Bool
parallel :: forall a. Epsilon a => Plucker a -> Plucker a -> Bool
parallel Plucker a
a Plucker a
b = forall a. Epsilon a => a -> Bool
nearZero forall a b. (a -> b) -> a -> b
$ V3 a
u1 forall a. Num a => V3 a -> V3 a -> V3 a
`cross` V3 a
u2
where V2 V3 a
u1 V3 a
_ = forall a. Plucker a -> V2 (V3 a)
toUV Plucker a
a
V2 V3 a
u2 V3 a
_ = forall a. Plucker a -> V2 (V3 a)
toUV Plucker a
b
{-# INLINE parallel #-}
toUV :: Plucker a -> V2 (V3 a)
toUV :: forall a. Plucker a -> V2 (V3 a)
toUV (Plucker a
a a
b a
c a
d a
e a
f) = forall a. a -> a -> V2 a
V2 (forall a. a -> a -> a -> V3 a
V3 a
a a
b a
c) (forall a. a -> a -> a -> V3 a
V3 a
d a
e a
f)
coincides :: (Epsilon a, Fractional a) => Plucker a -> Plucker a -> Bool
coincides :: forall a.
(Epsilon a, Fractional a) =>
Plucker a -> Plucker a -> Bool
coincides Plucker a
p1 Plucker a
p2 = forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
Foldable.all forall a. Epsilon a => a -> Bool
nearZero forall a b. (a -> b) -> a -> b
$ (a
s forall (f :: * -> *) a. (Functor f, Num a) => a -> f a -> f a
*^ Plucker a
p2) forall a. Num a => a -> a -> a
- Plucker a
p1
where s :: a
s = forall b a. b -> (a -> b) -> Maybe a -> b
maybe a
1 forall a. First a -> a
getFirst forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. OptionCompat a -> OptionCompat a
getOptionCompat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) m. (Foldable t, Monoid m) => t m -> m
fold forall a b. (a -> b) -> a -> b
$ forall {a}.
(Epsilon a, Fractional a) =>
a -> a -> OptionCompat (First a)
saveDiv forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Plucker a
p1 forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Plucker a
p2
saveDiv :: a -> a -> OptionCompat (First a)
saveDiv a
x a
y | forall a. Epsilon a => a -> Bool
nearZero a
y = forall a. OptionCompat a -> OptionCompat a
optionCompat forall a. Maybe a
Nothing
| Bool
otherwise = forall a. OptionCompat a -> OptionCompat a
optionCompat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall a. a -> First a
First (a
x forall a. Fractional a => a -> a -> a
/ a
y)
{-# INLINABLE coincides #-}
coincides' :: (Epsilon a, Fractional a, Ord a) => Plucker a -> Plucker a -> Bool
coincides' :: forall a.
(Epsilon a, Fractional a, Ord a) =>
Plucker a -> Plucker a -> Bool
coincides' Plucker a
p1 Plucker a
p2 = forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
Foldable.all forall a. Epsilon a => a -> Bool
nearZero ((a
s forall (f :: * -> *) a. (Functor f, Num a) => a -> f a -> f a
*^ Plucker a
p2) forall a. Num a => a -> a -> a
- Plucker a
p1) Bool -> Bool -> Bool
&& a
s forall a. Ord a => a -> a -> Bool
> a
0
where s :: a
s = forall b a. b -> (a -> b) -> Maybe a -> b
maybe a
1 forall a. First a -> a
getFirst forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. OptionCompat a -> OptionCompat a
getOptionCompat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) m. (Foldable t, Monoid m) => t m -> m
fold forall a b. (a -> b) -> a -> b
$ forall {a}.
(Epsilon a, Fractional a) =>
a -> a -> OptionCompat (First a)
saveDiv forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Plucker a
p1 forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Plucker a
p2
saveDiv :: a -> a -> OptionCompat (First a)
saveDiv a
x a
y | forall a. Epsilon a => a -> Bool
nearZero a
y = forall a. OptionCompat a -> OptionCompat a
optionCompat forall a. Maybe a
Nothing
| Bool
otherwise = forall a. OptionCompat a -> OptionCompat a
optionCompat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall a. a -> First a
First (a
x forall a. Fractional a => a -> a -> a
/ a
y)
{-# INLINABLE coincides' #-}
#if MIN_VERSION_base(4,11,0)
type OptionCompat = Maybe
optionCompat :: Maybe a -> OptionCompat a
optionCompat :: forall a. OptionCompat a -> OptionCompat a
optionCompat = forall a. a -> a
id
getOptionCompat :: OptionCompat a -> Maybe a
getOptionCompat :: forall a. OptionCompat a -> OptionCompat a
getOptionCompat = forall a. a -> a
id
#else
type OptionCompat = Option
optionCompat :: Maybe a -> OptionCompat a
optionCompat = Option
getOptionCompat :: OptionCompat a -> Maybe a
getOptionCompat = getOption
#endif
quadranceToOrigin :: Fractional a => Plucker a -> a
quadranceToOrigin :: forall a. Fractional a => Plucker a -> a
quadranceToOrigin Plucker a
p = (V3 a
v forall (f :: * -> *) a. (Metric f, Num a) => f a -> f a -> a
`dot` V3 a
v) forall a. Fractional a => a -> a -> a
/ (V3 a
u forall (f :: * -> *) a. (Metric f, Num a) => f a -> f a -> a
`dot` V3 a
u)
where V2 V3 a
u V3 a
v = forall a. Plucker a -> V2 (V3 a)
toUV Plucker a
p
{-# INLINE quadranceToOrigin #-}
closestToOrigin :: Fractional a => Plucker a -> V3 a
closestToOrigin :: forall a. Fractional a => Plucker a -> V3 a
closestToOrigin Plucker a
p = forall a. Fractional a => V4 a -> V3 a
normalizePoint forall a b. (a -> b) -> a -> b
$ forall a. a -> a -> a -> a -> V4 a
V4 a
x a
y a
z (V3 a
u forall (f :: * -> *) a. (Metric f, Num a) => f a -> f a -> a
`dot` V3 a
u)
where V2 V3 a
u V3 a
v = forall a. Plucker a -> V2 (V3 a)
toUV Plucker a
p
V3 a
x a
y a
z = V3 a
v forall a. Num a => V3 a -> V3 a -> V3 a
`cross` V3 a
u
{-# INLINE closestToOrigin #-}
isLine :: Epsilon a => Plucker a -> Bool
isLine :: forall a. Epsilon a => Plucker a -> Bool
isLine Plucker a
p = forall a. Epsilon a => a -> Bool
nearZero forall a b. (a -> b) -> a -> b
$ V3 a
u forall (f :: * -> *) a. (Metric f, Num a) => f a -> f a -> a
`dot` V3 a
v
where V2 V3 a
u V3 a
v = forall a. Plucker a -> V2 (V3 a)
toUV Plucker a
p
{-# INLINE isLine #-}
data instance U.Vector (Plucker a) = V_Plucker !Int (U.Vector a)
data instance U.MVector s (Plucker a) = MV_Plucker !Int (U.MVector s a)
instance U.Unbox a => U.Unbox (Plucker a)
instance U.Unbox a => M.MVector U.MVector (Plucker a) where
basicLength :: forall s. MVector s (Plucker a) -> Int
basicLength (MV_Plucker Int
n MVector s a
_) = Int
n
basicUnsafeSlice :: forall s.
Int -> Int -> MVector s (Plucker a) -> MVector s (Plucker a)
basicUnsafeSlice Int
m Int
n (MV_Plucker Int
_ MVector s a
v) = forall s a. Int -> MVector s a -> MVector s (Plucker a)
MV_Plucker Int
n (forall (v :: * -> * -> *) a s.
MVector v a =>
Int -> Int -> v s a -> v s a
M.basicUnsafeSlice (Int
6forall a. Num a => a -> a -> a
*Int
m) (Int
6forall a. Num a => a -> a -> a
*Int
n) MVector s a
v)
basicOverlaps :: forall s. MVector s (Plucker a) -> MVector s (Plucker a) -> Bool
basicOverlaps (MV_Plucker Int
_ MVector s a
v) (MV_Plucker Int
_ MVector s a
u) = forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> v s a -> Bool
M.basicOverlaps MVector s a
v MVector s a
u
basicUnsafeNew :: forall s. Int -> ST s (MVector s (Plucker a))
basicUnsafeNew Int
n = forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (forall s a. Int -> MVector s a -> MVector s (Plucker a)
MV_Plucker Int
n) (forall (v :: * -> * -> *) a s. MVector v a => Int -> ST s (v s a)
M.basicUnsafeNew (Int
6forall a. Num a => a -> a -> a
*Int
n))
basicUnsafeRead :: forall s. MVector s (Plucker a) -> Int -> ST s (Plucker a)
basicUnsafeRead (MV_Plucker Int
_ MVector s a
a) Int
i =
do let o :: Int
o = Int
6forall a. Num a => a -> a -> a
*Int
i
a
x <- forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> ST s a
M.basicUnsafeRead MVector s a
a Int
o
a
y <- forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> ST s a
M.basicUnsafeRead MVector s a
a (Int
oforall a. Num a => a -> a -> a
+Int
1)
a
z <- forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> ST s a
M.basicUnsafeRead MVector s a
a (Int
oforall a. Num a => a -> a -> a
+Int
2)
a
w <- forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> ST s a
M.basicUnsafeRead MVector s a
a (Int
oforall a. Num a => a -> a -> a
+Int
3)
a
v <- forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> ST s a
M.basicUnsafeRead MVector s a
a (Int
oforall a. Num a => a -> a -> a
+Int
4)
a
u <- forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> ST s a
M.basicUnsafeRead MVector s a
a (Int
oforall a. Num a => a -> a -> a
+Int
5)
forall (m :: * -> *) a. Monad m => a -> m a
return (forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
x a
y a
z a
w a
v a
u)
basicUnsafeWrite :: forall s. MVector s (Plucker a) -> Int -> Plucker a -> ST s ()
basicUnsafeWrite (MV_Plucker Int
_ MVector s a
a) Int
i (Plucker a
x a
y a
z a
w a
v a
u) =
do let o :: Int
o = Int
6forall a. Num a => a -> a -> a
*Int
i
forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> a -> ST s ()
M.basicUnsafeWrite MVector s a
a Int
o a
x
forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> a -> ST s ()
M.basicUnsafeWrite MVector s a
a (Int
oforall a. Num a => a -> a -> a
+Int
1) a
y
forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> a -> ST s ()
M.basicUnsafeWrite MVector s a
a (Int
oforall a. Num a => a -> a -> a
+Int
2) a
z
forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> a -> ST s ()
M.basicUnsafeWrite MVector s a
a (Int
oforall a. Num a => a -> a -> a
+Int
3) a
w
forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> a -> ST s ()
M.basicUnsafeWrite MVector s a
a (Int
oforall a. Num a => a -> a -> a
+Int
4) a
v
forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> a -> ST s ()
M.basicUnsafeWrite MVector s a
a (Int
oforall a. Num a => a -> a -> a
+Int
5) a
u
basicInitialize :: forall s. MVector s (Plucker a) -> ST s ()
basicInitialize (MV_Plucker Int
_ MVector s a
v) = forall (v :: * -> * -> *) a s. MVector v a => v s a -> ST s ()
M.basicInitialize MVector s a
v
instance U.Unbox a => G.Vector U.Vector (Plucker a) where
basicUnsafeFreeze :: forall s. Mutable Vector s (Plucker a) -> ST s (Vector (Plucker a))
basicUnsafeFreeze (MV_Plucker Int
n MVector s a
v) = forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM ( forall a. Int -> Vector a -> Vector (Plucker a)
V_Plucker Int
n) (forall (v :: * -> *) a s. Vector v a => Mutable v s a -> ST s (v a)
G.basicUnsafeFreeze MVector s a
v)
basicUnsafeThaw :: forall s. Vector (Plucker a) -> ST s (Mutable Vector s (Plucker a))
basicUnsafeThaw ( V_Plucker Int
n Vector a
v) = forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (forall s a. Int -> MVector s a -> MVector s (Plucker a)
MV_Plucker Int
n) (forall (v :: * -> *) a s. Vector v a => v a -> ST s (Mutable v s a)
G.basicUnsafeThaw Vector a
v)
basicLength :: Vector (Plucker a) -> Int
basicLength ( V_Plucker Int
n Vector a
_) = Int
n
basicUnsafeSlice :: Int -> Int -> Vector (Plucker a) -> Vector (Plucker a)
basicUnsafeSlice Int
m Int
n (V_Plucker Int
_ Vector a
v) = forall a. Int -> Vector a -> Vector (Plucker a)
V_Plucker Int
n (forall (v :: * -> *) a. Vector v a => Int -> Int -> v a -> v a
G.basicUnsafeSlice (Int
6forall a. Num a => a -> a -> a
*Int
m) (Int
6forall a. Num a => a -> a -> a
*Int
n) Vector a
v)
basicUnsafeIndexM :: Vector (Plucker a) -> Int -> Box (Plucker a)
basicUnsafeIndexM (V_Plucker Int
_ Vector a
a) Int
i =
do let o :: Int
o = Int
6forall a. Num a => a -> a -> a
*Int
i
a
x <- forall (v :: * -> *) a. Vector v a => v a -> Int -> Box a
G.basicUnsafeIndexM Vector a
a Int
o
a
y <- forall (v :: * -> *) a. Vector v a => v a -> Int -> Box a
G.basicUnsafeIndexM Vector a
a (Int
oforall a. Num a => a -> a -> a
+Int
1)
a
z <- forall (v :: * -> *) a. Vector v a => v a -> Int -> Box a
G.basicUnsafeIndexM Vector a
a (Int
oforall a. Num a => a -> a -> a
+Int
2)
a
w <- forall (v :: * -> *) a. Vector v a => v a -> Int -> Box a
G.basicUnsafeIndexM Vector a
a (Int
oforall a. Num a => a -> a -> a
+Int
3)
a
v <- forall (v :: * -> *) a. Vector v a => v a -> Int -> Box a
G.basicUnsafeIndexM Vector a
a (Int
oforall a. Num a => a -> a -> a
+Int
4)
a
u <- forall (v :: * -> *) a. Vector v a => v a -> Int -> Box a
G.basicUnsafeIndexM Vector a
a (Int
oforall a. Num a => a -> a -> a
+Int
5)
forall (m :: * -> *) a. Monad m => a -> m a
return (forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
x a
y a
z a
w a
v a
u)
instance MonadZip Plucker where
mzipWith :: forall a b c. (a -> b -> c) -> Plucker a -> Plucker b -> Plucker c
mzipWith = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2
instance MonadFix Plucker where
mfix :: forall a. (a -> Plucker a) -> Plucker a
mfix a -> Plucker a
f = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker (let Plucker a
a a
_ a
_ a
_ a
_ a
_ = a -> Plucker a
f a
a in a
a)
(let Plucker a
_ a
a a
_ a
_ a
_ a
_ = a -> Plucker a
f a
a in a
a)
(let Plucker a
_ a
_ a
a a
_ a
_ a
_ = a -> Plucker a
f a
a in a
a)
(let Plucker a
_ a
_ a
_ a
a a
_ a
_ = a -> Plucker a
f a
a in a
a)
(let Plucker a
_ a
_ a
_ a
_ a
a a
_ = a -> Plucker a
f a
a in a
a)
(let Plucker a
_ a
_ a
_ a
_ a
_ a
a = a -> Plucker a
f a
a in a
a)
instance NFData a => NFData (Plucker a) where
rnf :: Plucker a -> ()
rnf (Plucker a
a a
b a
c a
d a
e a
f) = forall a. NFData a => a -> ()
rnf a
a seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf a
b seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf a
c
seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf a
d seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf a
e seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf a
f
instance Serial1 Plucker where
serializeWith :: forall (m :: * -> *) a.
MonadPut m =>
(a -> m ()) -> Plucker a -> m ()
serializeWith = forall (t :: * -> *) (f :: * -> *) a b.
(Foldable t, Applicative f) =>
(a -> f b) -> t a -> f ()
traverse_
deserializeWith :: forall (m :: * -> *) a. MonadGet m => m a -> m (Plucker a)
deserializeWith m a
k = forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
k forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
k forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
k forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
k forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
k forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
k
instance Serial a => Serial (Plucker a) where
serialize :: forall (m :: * -> *). MonadPut m => Plucker a -> m ()
serialize = forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
serializeWith forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
serialize
deserialize :: forall (m :: * -> *). MonadGet m => m (Plucker a)
deserialize = forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadGet m) =>
m a -> m (f a)
deserializeWith forall a (m :: * -> *). (Serial a, MonadGet m) => m a
deserialize
instance Binary a => Binary (Plucker a) where
put :: Plucker a -> Put
put = forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
serializeWith forall t. Binary t => t -> Put
Binary.put
get :: Get (Plucker a)
get = forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadGet m) =>
m a -> m (f a)
deserializeWith forall t. Binary t => Get t
Binary.get
instance Serialize a => Serialize (Plucker a) where
put :: Putter (Plucker a)
put = forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
serializeWith forall t. Serialize t => Putter t
Cereal.put
get :: Get (Plucker a)
get = forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadGet m) =>
m a -> m (f a)
deserializeWith forall t. Serialize t => Get t
Cereal.get
instance Eq1 Plucker where
liftEq :: forall a b. (a -> b -> Bool) -> Plucker a -> Plucker b -> Bool
liftEq a -> b -> Bool
k (Plucker a
a1 a
b1 a
c1 a
d1 a
e1 a
f1)
(Plucker b
a2 b
b2 b
c2 b
d2 b
e2 b
f2)
= a -> b -> Bool
k a
a1 b
a2 Bool -> Bool -> Bool
&& a -> b -> Bool
k a
b1 b
b2 Bool -> Bool -> Bool
&& a -> b -> Bool
k a
c1 b
c2 Bool -> Bool -> Bool
&& a -> b -> Bool
k a
d1 b
d2 Bool -> Bool -> Bool
&& a -> b -> Bool
k a
e1 b
e2 Bool -> Bool -> Bool
&& a -> b -> Bool
k a
f1 b
f2
instance Ord1 Plucker where
liftCompare :: forall a b.
(a -> b -> Ordering) -> Plucker a -> Plucker b -> Ordering
liftCompare a -> b -> Ordering
k (Plucker a
a1 a
b1 a
c1 a
d1 a
e1 a
f1)
(Plucker b
a2 b
b2 b
c2 b
d2 b
e2 b
f2)
= a -> b -> Ordering
k a
a1 b
a2 forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
b1 b
b2 forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
c1 b
c2 forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
d1 b
d2 forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
e1 b
e2 forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
f1 b
f2
instance Read1 Plucker where
liftReadsPrec :: forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Plucker a)
liftReadsPrec Int -> ReadS a
k ReadS [a]
_ Int
z = forall a. Bool -> ReadS a -> ReadS a
readParen (Int
z forall a. Ord a => a -> a -> Bool
> Int
10) forall a b. (a -> b) -> a -> b
$ \String
r ->
[ (forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
a a
b a
c a
d a
e a
f, String
r7)
| (String
"Plucker",String
r1) <- ReadS String
lex String
r
, (a
a,String
r2) <- Int -> ReadS a
k Int
11 String
r1
, (a
b,String
r3) <- Int -> ReadS a
k Int
11 String
r2
, (a
c,String
r4) <- Int -> ReadS a
k Int
11 String
r3
, (a
d,String
r5) <- Int -> ReadS a
k Int
11 String
r4
, (a
e,String
r6) <- Int -> ReadS a
k Int
11 String
r5
, (a
f,String
r7) <- Int -> ReadS a
k Int
11 String
r6
]
instance Show1 Plucker where
liftShowsPrec :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Plucker a -> ShowS
liftShowsPrec Int -> a -> ShowS
k [a] -> ShowS
_ Int
z (Plucker a
a a
b a
c a
d a
e a
f) = Bool -> ShowS -> ShowS
showParen (Int
z forall a. Ord a => a -> a -> Bool
> Int
10) forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"Plucker " forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
k Int
11 a
a forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
k Int
11 a
b forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
k Int
11 a
c forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
k Int
11 a
d forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
k Int
11 a
e forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
k Int
11 a
f
instance Field1 (Plucker a) (Plucker a) a a where
_1 :: Lens (Plucker a) (Plucker a) a a
_1 a -> f a
f (Plucker a
x a
y a
z a
u a
v a
w) = a -> f a
f a
x forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
x' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
x' a
y a
z a
u a
v a
w
instance Field2 (Plucker a) (Plucker a) a a where
_2 :: Lens (Plucker a) (Plucker a) a a
_2 a -> f a
f (Plucker a
x a
y a
z a
u a
v a
w) = a -> f a
f a
y forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
y' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
x a
y' a
z a
u a
v a
w
instance Field3 (Plucker a) (Plucker a) a a where
_3 :: Lens (Plucker a) (Plucker a) a a
_3 a -> f a
f (Plucker a
x a
y a
z a
u a
v a
w) = a -> f a
f a
z forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
z' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
x a
y a
z' a
u a
v a
w
instance Field4 (Plucker a) (Plucker a) a a where
_4 :: Lens (Plucker a) (Plucker a) a a
_4 a -> f a
f (Plucker a
x a
y a
z a
u a
v a
w) = a -> f a
f a
u forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
u' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
x a
y a
z a
u' a
v a
w
instance Field5 (Plucker a) (Plucker a) a a where
_5 :: Lens (Plucker a) (Plucker a) a a
_5 a -> f a
f (Plucker a
x a
y a
z a
u a
v a
w) = a -> f a
f a
v forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
v' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
x a
y a
z a
u a
v' a
w
instance Field6 (Plucker a) (Plucker a) a a where
_6 :: Lens (Plucker a) (Plucker a) a a
_6 a -> f a
f (Plucker a
x a
y a
z a
u a
v a
w) = a -> f a
f a
w forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
w' -> forall a. a -> a -> a -> a -> a -> a -> Plucker a
Plucker a
x a
y a
z a
u a
v a
w'
instance Semigroup a => Semigroup (Plucker a) where
<> :: Plucker a -> Plucker a -> Plucker a
(<>) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Semigroup a => a -> a -> a
(<>)
instance Monoid a => Monoid (Plucker a) where
mempty :: Plucker a
mempty = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Monoid a => a
mempty
#if !(MIN_VERSION_base(4,11,0))
mappend = liftA2 mappend
#endif