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

Data.Geometry.Transformation

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 # Instance detailsDefined in Data.Geometry.Transformation Methodsfmap :: (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 # Instance detailsDefined in Data.Geometry.Transformation 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 # Instance detailsDefined in Data.Geometry.Transformation Methodscompare :: 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 # Instance detailsDefined in Data.Geometry.Transformation MethodsshowsPrec :: Int -> Matrix n m r -> ShowS #show :: Matrix n m r -> String #showList :: [Matrix n m r] -> ShowS # IpeWriteText r => IpeWriteText (Matrix 3 3 r) Source # Instance detailsDefined in Data.Geometry.Ipe.Writer MethodsipeWriteText :: Matrix 3 3 r -> Maybe Text Source # Coordinate r => IpeReadText (Matrix 3 3 r) Source # Instance detailsDefined in Data.Geometry.Ipe.Reader Methods 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_transformationMatrix :: Matrix (d + 1) (d + 1) r Instances  Arity (d + 1) => Functor (Transformation d) Source # Instance detailsDefined in Data.Geometry.Transformation Methodsfmap :: (a -> b) -> Transformation d a -> Transformation d b #(<$) :: a -> Transformation d b -> Transformation d a # (Eq r, Arity (d + 1)) => Eq (Transformation d r) Source # Instance detailsDefined in Data.Geometry.Transformation Methods(==) :: Transformation d r -> Transformation d r -> Bool #(/=) :: Transformation d r -> Transformation d r -> Bool # (Ord r, Arity (d + 1)) => Ord (Transformation d r) Source # Instance detailsDefined in Data.Geometry.Transformation Methodscompare :: Transformation d r -> Transformation d r -> Ordering #(<) :: Transformation d r -> Transformation d r -> Bool #(<=) :: Transformation d r -> Transformation d r -> Bool #(>) :: Transformation d r -> Transformation d r -> Bool #(>=) :: Transformation d r -> Transformation d r -> Bool #max :: Transformation d r -> Transformation d r -> Transformation d r #min :: Transformation d r -> Transformation d r -> Transformation d r # (Show r, Arity (d + 1)) => Show (Transformation d r) Source # Instance detailsDefined in Data.Geometry.Transformation MethodsshowsPrec :: Int -> Transformation d r -> ShowS #show :: Transformation d r -> String #showList :: [Transformation d r] -> ShowS # type NumType (Transformation d r) Source # Instance detailsDefined in Data.Geometry.Transformation type NumType (Transformation d r) = r

(|.|) :: (Num r, Arity (d + 1)) => 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
 Source # Instance detailsDefined in Data.Geometry.Boundary MethodstransformBy :: Transformation (Dimension (Boundary g)) (NumType (Boundary g)) -> Boundary g -> Boundary g Source # Source # Instance detailsDefined in Data.Geometry.Ipe.Types MethodstransformBy :: Transformation (Dimension (Image r)) (NumType (Image r)) -> Image r -> Image r Source # Source # Instance detailsDefined in Data.Geometry.Ipe.Types MethodstransformBy :: Transformation (Dimension (IpeSymbol r)) (NumType (IpeSymbol r)) -> IpeSymbol r -> IpeSymbol r Source # Source # Instance detailsDefined in Data.Geometry.Ipe.Types MethodstransformBy :: Transformation (Dimension (MiniPage r)) (NumType (MiniPage r)) -> MiniPage r -> MiniPage r Source # Source # Instance detailsDefined in Data.Geometry.Ipe.Types MethodstransformBy :: Transformation (Dimension (TextLabel r)) (NumType (TextLabel r)) -> TextLabel r -> TextLabel r Source # Source # Instance detailsDefined in Data.Geometry.Ipe.Types Methods Source # Instance detailsDefined in Data.Geometry.Ipe.Types MethodstransformBy :: Transformation (Dimension (Path r)) (NumType (Path r)) -> Path r -> Path r Source # Source # Instance detailsDefined in Data.Geometry.Ipe.Types MethodstransformBy :: Transformation (Dimension (IpeObject r)) (NumType (IpeObject r)) -> IpeObject r -> IpeObject r Source # Source # Instance detailsDefined in Data.Geometry.Ipe.Types MethodstransformBy :: Transformation (Dimension (Group r)) (NumType (Group r)) -> Group r -> Group r Source # (Fractional r, Arity d, Arity (d + 1)) => IsTransformable (Vector d r) Source # Instance detailsDefined in Data.Geometry.Transformation MethodstransformBy :: Transformation (Dimension (Vector d r)) (NumType (Vector d r)) -> Vector d r -> Vector d r Source # (Fractional r, Arity d, Arity (d + 1)) => IsTransformable (Point d r) Source # Instance detailsDefined in Data.Geometry.Transformation MethodstransformBy :: Transformation (Dimension (Point d r)) (NumType (Point d r)) -> Point d r -> Point d r Source # (Fractional r, Arity d, Arity (d + 1)) => IsTransformable (Line d r) Source # Lines are transformable, via line segments Instance detailsDefined in Data.Geometry.Line MethodstransformBy :: Transformation (Dimension (Line d r)) (NumType (Line d r)) -> Line d r -> Line d r Source # (Fractional r, Arity d, Arity (d + 1)) => IsTransformable (HalfLine d r) Source # Instance detailsDefined in Data.Geometry.HalfLine MethodstransformBy :: Transformation (Dimension (HalfLine d r)) (NumType (HalfLine d r)) -> HalfLine d r -> HalfLine d r Source # Source # Instance detailsDefined in Data.Geometry.Polygon.Convex MethodstransformBy :: Transformation (Dimension (ConvexPolygon p r)) (NumType (ConvexPolygon p r)) -> ConvexPolygon p r -> ConvexPolygon p r Source # (Fractional r, Arity d, Arity (d + 1)) => IsTransformable (Box d p r) Source # Instance detailsDefined in Data.Geometry.Box.Internal MethodstransformBy :: Transformation (Dimension (Box d p r)) (NumType (Box d p r)) -> Box d p r -> Box d p r Source # (Fractional r, Arity d, Arity (d + 1)) => IsTransformable (LineSegment d p r) Source # Instance detailsDefined in Data.Geometry.LineSegment MethodstransformBy :: Transformation (Dimension (LineSegment d p r)) (NumType (LineSegment d p r)) -> LineSegment d p r -> LineSegment d p r Source # (Fractional r, Arity d, Arity (d + 1)) => IsTransformable (PolyLine d p r) Source # Instance detailsDefined in Data.Geometry.PolyLine MethodstransformBy :: Transformation (Dimension (PolyLine d p r)) (NumType (PolyLine d p r)) -> PolyLine d p r -> PolyLine d p r Source # (Fractional r, Arity d, Arity (d + 1)) => IsTransformable (Triangle d p r) Source # Instance detailsDefined in Data.Geometry.Triangle MethodstransformBy :: Transformation (Dimension (Triangle d p r)) (NumType (Triangle d p r)) -> Triangle d p r -> Triangle d p r Source # Fractional r => IsTransformable (Polygon t p r) Source # Instance detailsDefined in Data.Geometry.Polygon MethodstransformBy :: Transformation (Dimension (Polygon t p r)) (NumType (Polygon t p r)) -> Polygon t p r -> Polygon t p r Source #

transformPointFunctor :: (PointFunctor g, Fractional r, d ~ Dimension (g r), Arity d, Arity (d + 1)) => Transformation d r -> g r -> g r Source #

Common transformations

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

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

uniformScaling :: (Num r, Arity d, Arity (d + 1)) => r -> Transformation d r 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, Arity (n + 1), Num r) => Int -> r -> Vector (n + 1) r Source #

Row in a translation matrix transRow :: forall n r. ( Arity n, Arity (n- 1), ((n - 1) + 1) ~ n , Num r) => Int -> r -> Vector n r transRow i x = set (V.element (Proxy :: Proxy (n-1))) x \$ mkRow i 1