linear-1.20.5: Linear Algebra

Copyright(C) 2012-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellTrustworthy
LanguageHaskell98

Linear.Plucker

Contents

Description

Plücker coordinates for lines in 3d homogeneous space.

Synopsis

Documentation

data Plucker a Source #

Plücker coordinates for lines in a 3-dimensional space.

Constructors

Plucker !a !a !a !a !a !a 

Instances

Monad Plucker Source # 

Methods

(>>=) :: Plucker a -> (a -> Plucker b) -> Plucker b #

(>>) :: Plucker a -> Plucker b -> Plucker b #

return :: a -> Plucker a #

fail :: String -> Plucker a #

Functor Plucker Source # 

Methods

fmap :: (a -> b) -> Plucker a -> Plucker b #

(<$) :: a -> Plucker b -> Plucker a #

MonadFix Plucker Source # 

Methods

mfix :: (a -> Plucker a) -> Plucker a #

Applicative Plucker Source # 

Methods

pure :: a -> Plucker a #

(<*>) :: Plucker (a -> b) -> Plucker a -> Plucker b #

(*>) :: Plucker a -> Plucker b -> Plucker b #

(<*) :: Plucker a -> Plucker b -> Plucker a #

Foldable Plucker Source # 

Methods

fold :: Monoid m => Plucker m -> m #

foldMap :: Monoid m => (a -> m) -> Plucker a -> m #

foldr :: (a -> b -> b) -> b -> Plucker a -> b #

foldr' :: (a -> b -> b) -> b -> Plucker a -> b #

foldl :: (b -> a -> b) -> b -> Plucker a -> b #

foldl' :: (b -> a -> b) -> b -> Plucker a -> b #

foldr1 :: (a -> a -> a) -> Plucker a -> a #

foldl1 :: (a -> a -> a) -> Plucker a -> a #

toList :: Plucker a -> [a] #

null :: Plucker a -> Bool #

length :: Plucker a -> Int #

elem :: Eq a => a -> Plucker a -> Bool #

maximum :: Ord a => Plucker a -> a #

minimum :: Ord a => Plucker a -> a #

sum :: Num a => Plucker a -> a #

product :: Num a => Plucker a -> a #

Traversable Plucker Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Plucker a -> f (Plucker b) #

sequenceA :: Applicative f => Plucker (f a) -> f (Plucker a) #

mapM :: Monad m => (a -> m b) -> Plucker a -> m (Plucker b) #

sequence :: Monad m => Plucker (m a) -> m (Plucker a) #

Generic1 Plucker Source # 

Associated Types

type Rep1 (Plucker :: * -> *) :: * -> * #

Methods

from1 :: Plucker a -> Rep1 Plucker a #

to1 :: Rep1 Plucker a -> Plucker a #

Distributive Plucker Source # 

Methods

distribute :: Functor f => f (Plucker a) -> Plucker (f a) #

collect :: Functor f => (a -> Plucker b) -> f a -> Plucker (f b) #

distributeM :: Monad m => m (Plucker a) -> Plucker (m a) #

collectM :: Monad m => (a -> Plucker b) -> m a -> Plucker (m b) #

Representable Plucker Source # 

Associated Types

type Rep (Plucker :: * -> *) :: * #

Methods

tabulate :: (Rep Plucker -> a) -> Plucker a #

index :: Plucker a -> Rep Plucker -> a #

Eq1 Plucker Source # 

Methods

liftEq :: (a -> b -> Bool) -> Plucker a -> Plucker b -> Bool #

Ord1 Plucker Source # 

Methods

liftCompare :: (a -> b -> Ordering) -> Plucker a -> Plucker b -> Ordering #

Read1 Plucker Source # 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Plucker a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Plucker a] #

Show1 Plucker Source # 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Plucker a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Plucker a] -> ShowS #

MonadZip Plucker Source # 

Methods

mzip :: Plucker a -> Plucker b -> Plucker (a, b) #

mzipWith :: (a -> b -> c) -> Plucker a -> Plucker b -> Plucker c #

munzip :: Plucker (a, b) -> (Plucker a, Plucker b) #

Serial1 Plucker Source # 

Methods

serializeWith :: MonadPut m => (a -> m ()) -> Plucker a -> m () #

deserializeWith :: MonadGet m => m a -> m (Plucker a) #

Traversable1 Plucker Source # 

Methods

traverse1 :: Apply f => (a -> f b) -> Plucker a -> f (Plucker b) #

sequence1 :: Apply f => Plucker (f b) -> f (Plucker b) #

Apply Plucker Source # 

Methods

(<.>) :: Plucker (a -> b) -> Plucker a -> Plucker b #

(.>) :: Plucker a -> Plucker b -> Plucker b #

(<.) :: Plucker a -> Plucker b -> Plucker a #

Bind Plucker Source # 

Methods

(>>-) :: Plucker a -> (a -> Plucker b) -> Plucker b #

join :: Plucker (Plucker a) -> Plucker a #

Foldable1 Plucker Source # 

Methods

fold1 :: Semigroup m => Plucker m -> m #

foldMap1 :: Semigroup m => (a -> m) -> Plucker a -> m #

Additive Plucker Source # 

Methods

zero :: Num a => Plucker a Source #

(^+^) :: Num a => Plucker a -> Plucker a -> Plucker a Source #

(^-^) :: Num a => Plucker a -> Plucker a -> Plucker a Source #

lerp :: Num a => a -> Plucker a -> Plucker a -> Plucker a Source #

liftU2 :: (a -> a -> a) -> Plucker a -> Plucker a -> Plucker a Source #

liftI2 :: (a -> b -> c) -> Plucker a -> Plucker b -> Plucker c Source #

Metric Plucker Source # 

Methods

dot :: Num a => Plucker a -> Plucker a -> a Source #

quadrance :: Num a => Plucker a -> a Source #

qd :: Num a => Plucker a -> Plucker a -> a Source #

distance :: Floating a => Plucker a -> Plucker a -> a Source #

norm :: Floating a => Plucker a -> a Source #

signorm :: Floating a => Plucker a -> Plucker a Source #

Trace Plucker Source # 

Methods

trace :: Num a => Plucker (Plucker a) -> a Source #

diagonal :: Plucker (Plucker a) -> Plucker a Source #

Affine Plucker Source # 

Associated Types

type Diff (Plucker :: * -> *) :: * -> * Source #

Methods

(.-.) :: Num a => Plucker a -> Plucker a -> Diff Plucker a Source #

(.+^) :: Num a => Plucker a -> Diff Plucker a -> Plucker a Source #

(.-^) :: Num a => Plucker a -> Diff Plucker a -> Plucker a Source #

Unbox a => Vector Vector (Plucker a) Source # 
Unbox a => MVector MVector (Plucker a) Source # 
Eq a => Eq (Plucker a) Source # 

Methods

(==) :: Plucker a -> Plucker a -> Bool #

(/=) :: Plucker a -> Plucker a -> Bool #

Floating a => Floating (Plucker a) Source # 

Methods

pi :: Plucker a #

exp :: Plucker a -> Plucker a #

log :: Plucker a -> Plucker a #

sqrt :: Plucker a -> Plucker a #

(**) :: Plucker a -> Plucker a -> Plucker a #

logBase :: Plucker a -> Plucker a -> Plucker a #

sin :: Plucker a -> Plucker a #

cos :: Plucker a -> Plucker a #

tan :: Plucker a -> Plucker a #

asin :: Plucker a -> Plucker a #

acos :: Plucker a -> Plucker a #

atan :: Plucker a -> Plucker a #

sinh :: Plucker a -> Plucker a #

cosh :: Plucker a -> Plucker a #

tanh :: Plucker a -> Plucker a #

asinh :: Plucker a -> Plucker a #

acosh :: Plucker a -> Plucker a #

atanh :: Plucker a -> Plucker a #

log1p :: Plucker a -> Plucker a #

expm1 :: Plucker a -> Plucker a #

log1pexp :: Plucker a -> Plucker a #

log1mexp :: Plucker a -> Plucker a #

Fractional a => Fractional (Plucker a) Source # 

Methods

(/) :: Plucker a -> Plucker a -> Plucker a #

recip :: Plucker a -> Plucker a #

fromRational :: Rational -> Plucker a #

Num a => Num (Plucker a) Source # 

Methods

(+) :: Plucker a -> Plucker a -> Plucker a #

(-) :: Plucker a -> Plucker a -> Plucker a #

(*) :: Plucker a -> Plucker a -> Plucker a #

negate :: Plucker a -> Plucker a #

abs :: Plucker a -> Plucker a #

signum :: Plucker a -> Plucker a #

fromInteger :: Integer -> Plucker a #

Ord a => Ord (Plucker a) Source # 

Methods

compare :: Plucker a -> Plucker a -> Ordering #

(<) :: Plucker a -> Plucker a -> Bool #

(<=) :: Plucker a -> Plucker a -> Bool #

(>) :: Plucker a -> Plucker a -> Bool #

(>=) :: Plucker a -> Plucker a -> Bool #

max :: Plucker a -> Plucker a -> Plucker a #

min :: Plucker a -> Plucker a -> Plucker a #

Read a => Read (Plucker a) Source # 
Show a => Show (Plucker a) Source # 

Methods

showsPrec :: Int -> Plucker a -> ShowS #

show :: Plucker a -> String #

showList :: [Plucker a] -> ShowS #

Ix a => Ix (Plucker a) Source # 

Methods

range :: (Plucker a, Plucker a) -> [Plucker a] #

index :: (Plucker a, Plucker a) -> Plucker a -> Int #

unsafeIndex :: (Plucker a, Plucker a) -> Plucker a -> Int

inRange :: (Plucker a, Plucker a) -> Plucker a -> Bool #

rangeSize :: (Plucker a, Plucker a) -> Int #

unsafeRangeSize :: (Plucker a, Plucker a) -> Int

Generic (Plucker a) Source # 

Associated Types

type Rep (Plucker a) :: * -> * #

Methods

from :: Plucker a -> Rep (Plucker a) x #

to :: Rep (Plucker a) x -> Plucker a #

Storable a => Storable (Plucker a) Source # 

Methods

sizeOf :: Plucker a -> Int #

alignment :: Plucker a -> Int #

peekElemOff :: Ptr (Plucker a) -> Int -> IO (Plucker a) #

pokeElemOff :: Ptr (Plucker a) -> Int -> Plucker a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Plucker a) #

pokeByteOff :: Ptr b -> Int -> Plucker a -> IO () #

peek :: Ptr (Plucker a) -> IO (Plucker a) #

poke :: Ptr (Plucker a) -> Plucker a -> IO () #

Binary a => Binary (Plucker a) Source # 

Methods

put :: Plucker a -> Put #

get :: Get (Plucker a) #

putList :: [Plucker a] -> Put #

Serial a => Serial (Plucker a) Source # 

Methods

serialize :: MonadPut m => Plucker a -> m () #

deserialize :: MonadGet m => m (Plucker a) #

Serialize a => Serialize (Plucker a) Source # 

Methods

put :: Putter (Plucker a) #

get :: Get (Plucker a) #

NFData a => NFData (Plucker a) Source # 

Methods

rnf :: Plucker a -> () #

Hashable a => Hashable (Plucker a) Source # 

Methods

hashWithSalt :: Int -> Plucker a -> Int #

hash :: Plucker a -> Int #

Unbox a => Unbox (Plucker a) Source # 
Ixed (Plucker a) Source # 

Methods

ix :: Index (Plucker a) -> Traversal' (Plucker a) (IxValue (Plucker a)) #

Epsilon a => Epsilon (Plucker a) Source # 

Methods

nearZero :: Plucker a -> Bool Source #

FunctorWithIndex (E Plucker) Plucker Source # 

Methods

imap :: (E Plucker -> a -> b) -> Plucker a -> Plucker b #

imapped :: (Indexable (E Plucker) p, Settable f) => p a (f b) -> Plucker a -> f (Plucker b) #

FoldableWithIndex (E Plucker) Plucker Source # 

Methods

ifoldMap :: Monoid m => (E Plucker -> a -> m) -> Plucker a -> m #

ifolded :: (Indexable (E Plucker) p, Contravariant f, Applicative f) => p a (f a) -> Plucker a -> f (Plucker a) #

ifoldr :: (E Plucker -> a -> b -> b) -> b -> Plucker a -> b #

ifoldl :: (E Plucker -> b -> a -> b) -> b -> Plucker a -> b #

ifoldr' :: (E Plucker -> a -> b -> b) -> b -> Plucker a -> b #

ifoldl' :: (E Plucker -> b -> a -> b) -> b -> Plucker a -> b #

TraversableWithIndex (E Plucker) Plucker Source # 

Methods

itraverse :: Applicative f => (E Plucker -> a -> f b) -> Plucker a -> f (Plucker b) #

itraversed :: (Indexable (E Plucker) p, Applicative f) => p a (f b) -> Plucker a -> f (Plucker b) #

Each (Plucker a) (Plucker b) a b Source # 

Methods

each :: Traversal (Plucker a) (Plucker b) a b #

type Rep1 Plucker Source # 
type Rep Plucker Source # 
type Diff Plucker Source # 
data MVector s (Plucker a) Source # 
data MVector s (Plucker a) = MV_Plucker !Int (MVector s a)
type Rep (Plucker a) Source # 
data Vector (Plucker a) Source # 
type Index (Plucker a) Source # 
type Index (Plucker a) = E Plucker
type IxValue (Plucker a) Source # 
type IxValue (Plucker a) = a

squaredError :: Num a => Plucker a -> a Source #

Valid Plücker coordinates p will have squaredError p == 0

That said, floating point makes a mockery of this claim, so you may want to use nearZero.

isotropic :: Epsilon a => Plucker a -> Bool Source #

Checks if the line is near-isotropic (isotropic vectors in this quadratic space represent lines in real 3d space).

(><) :: Num a => Plucker a -> Plucker a -> a infixl 5 Source #

This isn't th actual metric because this bilinear form gives rise to an isotropic quadratic space

plucker :: Num a => V4 a -> V4 a -> Plucker a Source #

Given a pair of points represented by homogeneous coordinates generate Plücker coordinates for the line through them, directed from the second towards the first.

plucker3D :: Num a => V3 a -> V3 a -> Plucker a Source #

Given a pair of 3D points, generate Plücker coordinates for the line through them, directed from the second towards the first.

Operations on lines

parallel :: Epsilon a => Plucker a -> Plucker a -> Bool Source #

Checks if two lines are parallel.

intersects :: (Epsilon a, Ord a) => Plucker a -> Plucker a -> Bool Source #

Checks if two lines intersect (or nearly intersect).

data LinePass Source #

Describe how two lines pass each other.

Constructors

Coplanar

The lines are coplanar (parallel or intersecting).

Clockwise

The lines pass each other clockwise (right-handed screw)

Counterclockwise

The lines pass each other counterclockwise (left-handed screw).

Instances

Eq LinePass Source # 
Show LinePass Source # 
Generic LinePass Source # 

Associated Types

type Rep LinePass :: * -> * #

Methods

from :: LinePass -> Rep LinePass x #

to :: Rep LinePass x -> LinePass #

type Rep LinePass Source # 
type Rep LinePass = D1 (MetaData "LinePass" "Linear.Plucker" "linear-1.20.5-ALqHTYew01KD1PdDd6TYmz" False) ((:+:) (C1 (MetaCons "Coplanar" PrefixI False) U1) ((:+:) (C1 (MetaCons "Clockwise" PrefixI False) U1) (C1 (MetaCons "Counterclockwise" PrefixI False) U1)))

passes :: (Epsilon a, Ord a) => Plucker a -> Plucker a -> LinePass Source #

Check how two lines pass each other. passes l1 l2 describes l2 when looking down l1.

quadranceToOrigin :: Fractional a => Plucker a -> a Source #

The minimum squared distance of a line from the origin.

closestToOrigin :: Fractional a => Plucker a -> V3 a Source #

The point where a line is closest to the origin.

isLine :: Epsilon a => Plucker a -> Bool Source #

Not all 6-dimensional points correspond to a line in 3D. This predicate tests that a Plücker coordinate lies on the Grassmann manifold, and does indeed represent a 3D line.

coincides :: (Epsilon a, Fractional a) => Plucker a -> Plucker a -> Bool Source #

Checks if two lines coincide in space. In other words, undirected equality.

coincides' :: (Epsilon a, Fractional a, Ord a) => Plucker a -> Plucker a -> Bool Source #

Checks if two lines coincide in space, and have the same orientation.

Basis elements

p01 :: Lens' (Plucker a) a Source #

These elements form a basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p01 :: Lens' (Plucker a) a
p02 :: Lens' (Plucker a) a
p03 :: Lens' (Plucker a) a
p23 :: Lens' (Plucker a) a
p31 :: Lens' (Plucker a) a
p12 :: Lens' (Plucker a) a

p02 :: Lens' (Plucker a) a Source #

These elements form a basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p01 :: Lens' (Plucker a) a
p02 :: Lens' (Plucker a) a
p03 :: Lens' (Plucker a) a
p23 :: Lens' (Plucker a) a
p31 :: Lens' (Plucker a) a
p12 :: Lens' (Plucker a) a

p03 :: Lens' (Plucker a) a Source #

These elements form a basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p01 :: Lens' (Plucker a) a
p02 :: Lens' (Plucker a) a
p03 :: Lens' (Plucker a) a
p23 :: Lens' (Plucker a) a
p31 :: Lens' (Plucker a) a
p12 :: Lens' (Plucker a) a

p10 :: (Functor f, Num a) => (a -> f a) -> Plucker a -> f (Plucker a) Source #

These elements form an alternate basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p10 :: Num a => Lens' (Plucker a) a
p20 :: Num a => Lens' (Plucker a) a
p30 :: Num a => Lens' (Plucker a) a
p32 :: Num a => Lens' (Plucker a) a
p13 :: Num a => Lens' (Plucker a) a
p21 :: Num a => Lens' (Plucker a) a

p12 :: Lens' (Plucker a) a Source #

These elements form a basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p01 :: Lens' (Plucker a) a
p02 :: Lens' (Plucker a) a
p03 :: Lens' (Plucker a) a
p23 :: Lens' (Plucker a) a
p31 :: Lens' (Plucker a) a
p12 :: Lens' (Plucker a) a

p13 :: (Functor f, Num a) => (a -> f a) -> Plucker a -> f (Plucker a) Source #

These elements form an alternate basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p10 :: Num a => Lens' (Plucker a) a
p20 :: Num a => Lens' (Plucker a) a
p30 :: Num a => Lens' (Plucker a) a
p32 :: Num a => Lens' (Plucker a) a
p13 :: Num a => Lens' (Plucker a) a
p21 :: Num a => Lens' (Plucker a) a

p20 :: (Functor f, Num a) => (a -> f a) -> Plucker a -> f (Plucker a) Source #

These elements form an alternate basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p10 :: Num a => Lens' (Plucker a) a
p20 :: Num a => Lens' (Plucker a) a
p30 :: Num a => Lens' (Plucker a) a
p32 :: Num a => Lens' (Plucker a) a
p13 :: Num a => Lens' (Plucker a) a
p21 :: Num a => Lens' (Plucker a) a

p21 :: (Functor f, Num a) => (a -> f a) -> Plucker a -> f (Plucker a) Source #

These elements form an alternate basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p10 :: Num a => Lens' (Plucker a) a
p20 :: Num a => Lens' (Plucker a) a
p30 :: Num a => Lens' (Plucker a) a
p32 :: Num a => Lens' (Plucker a) a
p13 :: Num a => Lens' (Plucker a) a
p21 :: Num a => Lens' (Plucker a) a

p23 :: Lens' (Plucker a) a Source #

These elements form a basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p01 :: Lens' (Plucker a) a
p02 :: Lens' (Plucker a) a
p03 :: Lens' (Plucker a) a
p23 :: Lens' (Plucker a) a
p31 :: Lens' (Plucker a) a
p12 :: Lens' (Plucker a) a

p30 :: (Functor f, Num a) => (a -> f a) -> Plucker a -> f (Plucker a) Source #

These elements form an alternate basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p10 :: Num a => Lens' (Plucker a) a
p20 :: Num a => Lens' (Plucker a) a
p30 :: Num a => Lens' (Plucker a) a
p32 :: Num a => Lens' (Plucker a) a
p13 :: Num a => Lens' (Plucker a) a
p21 :: Num a => Lens' (Plucker a) a

p31 :: Lens' (Plucker a) a Source #

These elements form a basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p01 :: Lens' (Plucker a) a
p02 :: Lens' (Plucker a) a
p03 :: Lens' (Plucker a) a
p23 :: Lens' (Plucker a) a
p31 :: Lens' (Plucker a) a
p12 :: Lens' (Plucker a) a

p32 :: (Functor f, Num a) => (a -> f a) -> Plucker a -> f (Plucker a) Source #

These elements form an alternate basis for the Plücker space, or the Grassmanian manifold Gr(2,V4).

p10 :: Num a => Lens' (Plucker a) a
p20 :: Num a => Lens' (Plucker a) a
p30 :: Num a => Lens' (Plucker a) a
p32 :: Num a => Lens' (Plucker a) a
p13 :: Num a => Lens' (Plucker a) a
p21 :: Num a => Lens' (Plucker a) a