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

Safe HaskellNone
LanguageHaskell2010

Data.Geometry.Transformation

Contents

Synopsis

Matrices

newtype Matrix n m r Source #

a matrix of n rows, each of m columns, storing values of type r

Constructors

Matrix (Vector n (Vector m r)) 

Instances

(Arity n, Arity m) => Functor (Matrix n m) Source # 

Methods

fmap :: (a -> b) -> Matrix n m a -> Matrix n m b #

(<$) :: a -> Matrix n m b -> Matrix n m a #

(Eq r, Arity n, Arity m) => Eq (Matrix n m r) Source # 

Methods

(==) :: Matrix n m r -> Matrix n m r -> Bool #

(/=) :: Matrix n m r -> Matrix n m r -> Bool #

(Ord r, Arity n, Arity m) => Ord (Matrix n m r) Source # 

Methods

compare :: Matrix n m r -> Matrix n m r -> Ordering #

(<) :: Matrix n m r -> Matrix n m r -> Bool #

(<=) :: Matrix n m r -> Matrix n m r -> Bool #

(>) :: Matrix n m r -> Matrix n m r -> Bool #

(>=) :: Matrix n m r -> Matrix n m r -> Bool #

max :: Matrix n m r -> Matrix n m r -> Matrix n m r #

min :: Matrix n m r -> Matrix n m r -> Matrix n m r #

(Show r, Arity n, Arity m) => Show (Matrix n m r) Source # 

Methods

showsPrec :: Int -> Matrix n m r -> ShowS #

show :: Matrix n m r -> String #

showList :: [Matrix n m r] -> ShowS #

Coordinate r => IpeReadText (Matrix 3 3 r) Source # 
IpeWriteText r => IpeWriteText (Matrix 3 3 r) Source # 

Methods

ipeWriteText :: Matrix 3 3 r -> Maybe Text Source #

multM :: (Arity r, Arity c, Arity c', Num a) => Matrix r c a -> Matrix c c' a -> Matrix r c' a Source #

mult :: (Arity m, Arity n, Num r) => Matrix n m r -> Vector m r -> Vector n r Source #

Transformations

newtype Transformation d r Source #

A type representing a Transformation for d dimensional objects

Constructors

Transformation 

Fields

Instances

(|.|) :: (Num r, Arity (1 + d)) => Transformation d r -> Transformation d r -> Transformation d r Source #

Compose transformations (right to left)

Transformable geometry objects

class IsTransformable g where Source #

A class representing types that can be transformed using a transformation

Minimal complete definition

transformBy

Methods

transformBy :: Transformation (Dimension g) (NumType g) -> g -> g Source #

Instances

IsTransformable g => IsTransformable (Boundary g) Source # 
Num r => IsTransformable (Image r) Source # 
Num r => IsTransformable (IpeSymbol r) Source # 
Num r => IsTransformable (MiniPage r) Source # 
Num r => IsTransformable (TextLabel r) Source # 
Num r => IsTransformable (PathSegment r) Source # 
Num r => IsTransformable (Path r) Source # 
Num r => IsTransformable (IpeObject r) Source # 
Num r => IsTransformable (Group r) Source # 
(Num r, Arity d, AlwaysTrueDestruct d ((+) 1 d)) => IsTransformable (Point d r) Source # 

Methods

transformBy :: Transformation (Dimension (Point d r)) (NumType (Point d r)) -> Point d r -> Point d r Source #

(Num r, AlwaysTruePFT d) => IsTransformable (HalfLine d r) Source # 
Num r => IsTransformable (ConvexPolygon p r) Source # 
Num r => IsTransformable (Triangle d r) Source # 
(Num r, AlwaysTruePFT d) => IsTransformable (Box d p r) Source # 

Methods

transformBy :: Transformation (Dimension (Box d p r)) (NumType (Box d p r)) -> Box d p r -> Box d p r Source #

(Num r, AlwaysTruePFT d) => IsTransformable (LineSegment d p r) Source # 
(Num r, AlwaysTruePFT d) => IsTransformable (PolyLine d p r) Source # 

Methods

transformBy :: Transformation (Dimension (PolyLine d p r)) (NumType (PolyLine d p r)) -> PolyLine d p r -> PolyLine d p r Source #

Num r => IsTransformable (Polygon t p r) Source # 

Methods

transformBy :: Transformation (Dimension (Polygon t p r)) (NumType (Polygon t p r)) -> Polygon t p r -> Polygon t p r Source #

Common transformations

translation :: (Num r, Arity (1 + d), AlwaysTrueSnoc d, Arity d, Index' ((1 + d) - 1) (1 + d)) => Vector d r -> Transformation d r Source #

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

Functions that execute transformations

type AlwaysTrueTransformation d = (Arity (1 + d), AlwaysTrueSnoc d, Arity d, Index' ((1 + d) - 1) (1 + d)) Source #

Helper functions to easily create matrices

mkRow :: forall d r. (Arity d, Num r) => Int -> r -> Vector d r Source #

Creates a row with zeroes everywhere, except at position i, where the value is the supplied value.

transRow :: forall n r. (Arity n, Index' (n - 1) n, Num r) => Int -> r -> Vector n r Source #

Row in a translation matrix