hgeometry-0.6.0.0: Geometric Algorithms, Data structures, and Data types.

Safe HaskellNone
LanguageHaskell2010

Data.Geometry.Vector.VectorFixed

Contents

Synopsis

Documentation

data C n Source #

A proxy which can be used for the coordinates.

Constructors

C 

Instances

Eq (C n) Source # 

Methods

(==) :: C n -> C n -> Bool #

(/=) :: C n -> C n -> Bool #

Ord (C n) Source # 

Methods

compare :: C n -> C n -> Ordering #

(<) :: C n -> C n -> Bool #

(<=) :: C n -> C n -> Bool #

(>) :: C n -> C n -> Bool #

(>=) :: C n -> C n -> Bool #

max :: C n -> C n -> C n #

min :: C n -> C n -> C n #

Read (C n) Source # 

Methods

readsPrec :: Int -> ReadS (C n) #

readList :: ReadS [C n] #

readPrec :: ReadPrec (C n) #

readListPrec :: ReadPrec [C n] #

Show (C n) Source # 

Methods

showsPrec :: Int -> C n -> ShowS #

show :: C n -> String #

showList :: [C n] -> ShowS #

d dimensional Vectors

newtype Vector d r Source #

Datatype representing d dimensional vectors. Our implementation wraps the implementation provided by fixed-vector.

Constructors

Vector 

Fields

Instances

Arity d => Functor (Vector d) Source # 

Methods

fmap :: (a -> b) -> Vector d a -> Vector d b #

(<$) :: a -> Vector d b -> Vector d a #

Arity d => Applicative (Vector d) Source # 

Methods

pure :: a -> Vector d a #

(<*>) :: Vector d (a -> b) -> Vector d a -> Vector d b #

(*>) :: Vector d a -> Vector d b -> Vector d b #

(<*) :: Vector d a -> Vector d b -> Vector d a #

Arity d => Foldable (Vector d) Source # 

Methods

fold :: Monoid m => Vector d m -> m #

foldMap :: Monoid m => (a -> m) -> Vector d a -> m #

foldr :: (a -> b -> b) -> b -> Vector d a -> b #

foldr' :: (a -> b -> b) -> b -> Vector d a -> b #

foldl :: (b -> a -> b) -> b -> Vector d a -> b #

foldl' :: (b -> a -> b) -> b -> Vector d a -> b #

foldr1 :: (a -> a -> a) -> Vector d a -> a #

foldl1 :: (a -> a -> a) -> Vector d a -> a #

toList :: Vector d a -> [a] #

null :: Vector d a -> Bool #

length :: Vector d a -> Int #

elem :: Eq a => a -> Vector d a -> Bool #

maximum :: Ord a => Vector d a -> a #

minimum :: Ord a => Vector d a -> a #

sum :: Num a => Vector d a -> a #

product :: Num a => Vector d a -> a #

Arity d => Traversable (Vector d) Source # 

Methods

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

sequenceA :: Applicative f => Vector d (f a) -> f (Vector d a) #

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

sequence :: Monad m => Vector d (m a) -> m (Vector d a) #

Arity d => Affine (Vector d) Source # 

Associated Types

type Diff (Vector d :: * -> *) :: * -> * #

Methods

(.-.) :: Num a => Vector d a -> Vector d a -> Diff (Vector d) a #

(.+^) :: Num a => Vector d a -> Diff (Vector d) a -> Vector d a #

(.-^) :: Num a => Vector d a -> Diff (Vector d) a -> Vector d a #

Arity d => Metric (Vector d) Source # 

Methods

dot :: Num a => Vector d a -> Vector d a -> a #

quadrance :: Num a => Vector d a -> a #

qd :: Num a => Vector d a -> Vector d a -> a #

distance :: Floating a => Vector d a -> Vector d a -> a #

norm :: Floating a => Vector d a -> a #

signorm :: Floating a => Vector d a -> Vector d a #

Arity d => Additive (Vector d) Source # 

Methods

zero :: Num a => Vector d a #

(^+^) :: Num a => Vector d a -> Vector d a -> Vector d a #

(^-^) :: Num a => Vector d a -> Vector d a -> Vector d a #

lerp :: Num a => a -> Vector d a -> Vector d a -> Vector d a #

liftU2 :: (a -> a -> a) -> Vector d a -> Vector d a -> Vector d a #

liftI2 :: (a -> b -> c) -> Vector d a -> Vector d b -> Vector d c #

Arity d => Vector (Vector d) r Source # 

Methods

construct :: Fun (Dim (Vector d)) r (Vector d r) #

inspect :: Vector d r -> Fun (Dim (Vector d)) r b -> b #

basicIndex :: Vector d r -> Int -> r #

(Eq r, Arity d) => Eq (Vector d r) Source # 

Methods

(==) :: Vector d r -> Vector d r -> Bool #

(/=) :: Vector d r -> Vector d r -> Bool #

(Ord r, Arity d) => Ord (Vector d r) Source # 

Methods

compare :: Vector d r -> Vector d r -> Ordering #

(<) :: Vector d r -> Vector d r -> Bool #

(<=) :: Vector d r -> Vector d r -> Bool #

(>) :: Vector d r -> Vector d r -> Bool #

(>=) :: Vector d r -> Vector d r -> Bool #

max :: Vector d r -> Vector d r -> Vector d r #

min :: Vector d r -> Vector d r -> Vector d r #

(Show r, Arity d) => Show (Vector d r) Source # 

Methods

showsPrec :: Int -> Vector d r -> ShowS #

show :: Vector d r -> String #

showList :: [Vector d r] -> ShowS #

Generic (Vector d r) Source # 

Associated Types

type Rep (Vector d r) :: * -> * #

Methods

from :: Vector d r -> Rep (Vector d r) x #

to :: Rep (Vector d r) x -> Vector d r #

(Arity d, NFData r) => NFData (Vector d r) Source # 

Methods

rnf :: Vector d r -> () #

type Dim (Vector d) Source # 
type Dim (Vector d) = ToPeano d
type Diff (Vector d) Source # 
type Diff (Vector d) = Vector d
type Rep (Vector d r) Source # 
type Rep (Vector d r) = D1 (MetaData "Vector" "Data.Geometry.Vector.VectorFixed" "hgeometry-0.6.0.0-ODn7ZyBfwj6IkLPAAzetJ" True) (C1 (MetaCons "Vector" PrefixI True) (S1 (MetaSel (Just Symbol "_unV") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Vec (ToPeano d) r))))

unV :: Lens' (Vector d r) (Vec (ToPeano d) r) Source #

type Arity n = Arity (ToPeano n) Source #

type Index' i d = Index (ToPeano i) (ToPeano d) Source #

element :: forall proxy i d r. (Arity d, Index' i d) => proxy i -> Lens' (Vector d r) r Source #

Lens into the i th element

element' :: forall d r. (KnownNat d, Arity d) => Int -> Traversal' (Vector d r) r Source #

Similar to element above. Except that we don't have a static guarantee that the index is in bounds. Hence, we can only return a Traversal

vectorFromList :: Arity d => [a] -> Maybe (Vector d a) Source #

type AlwaysTrueDestruct pd d = (Arity pd, ToPeano d ~ S (ToPeano pd)) Source #

destruct :: AlwaysTrueDestruct predD d => Vector d r -> (r, Vector predD r) Source #

Get the head and tail of a vector

cross :: Num r => Vector 3 r -> Vector 3 r -> Vector 3 r Source #

Cross product of two three-dimensional vectors

toV3 :: Vector 3 a -> V3 a Source #

Conversion to a Linear.V3

fromV3 :: V3 a -> Vector 3 a Source #

Conversion from a Linear.V3

type AlwaysTrueSnoc d = ToPeano (1 + d) ~ S (ToPeano d) Source #

snoc :: (AlwaysTrueSnoc d, Arity d) => Vector d r -> r -> Vector (1 + d) r Source #

Add an element at the back of the vector

init :: AlwaysTrueDestruct predD d => Vector d r -> Vector predD r Source #

Get a vector of the first d - 1 elements.

prefix :: Prefix (ToPeano i) (ToPeano d) => Vector d r -> Vector i r Source #

Get a prefix of i elements of a vector

class Prefix i d where Source #

Minimal complete definition

prefix'

Methods

prefix' :: Vec d r -> Vec i r Source #

Instances

Prefix Z d Source # 

Methods

prefix' :: Vec d r -> Vec Z r Source #

(Arity i, Arity d, Prefix i d) => Prefix (S i) (S d) Source # 

Methods

prefix' :: Vec (S d) r -> Vec (S i) r Source #

imap :: Arity d => (Int -> r -> s) -> Vector d r -> Vector d s Source #

Map with indices

Functions specific to two and three dimensional vectors.

v2 :: r -> r -> Vector 2 r Source #

Construct a 2 dimensional vector

v3 :: r -> r -> r -> Vector 3 r Source #

Construct a 3 dimensional vector

_unV2 :: Vector 2 r -> (r, r) Source #

Destruct a 2 dim vector into a pair

_unV3 :: Vector 3 r -> (r, r, r) Source #

pattern Vector2 :: forall r. r -> r -> Vector 2 r Source #

Pattern synonym for two and three dim vectors

pattern Vector3 :: forall r. r -> r -> r -> Vector 3 r Source #