hgeometry- Geometry types in Haskell

Safe HaskellNone




Point based geometries

class IsPoint2Functor g whereSource

Point based geometries

A class that defines a point2 functor. This defines that every operation that we can do on a point we can also do on instances of this class. i.e. by applying the operation on the underlying points.


p2fmap :: (Point2' a -> Point2' b) -> g a -> g bSource

class IsTransformable g whereSource

Class that indicates that something can be transformable using an affine transformation


transformWith :: Num a => Matrix3 a -> g a -> g aSource


IsPoint2Functor g => IsTransformable g 
IsTransformable Point2'

Points are transformable

newtype Vec3 a Source

Basic linear algebra to support affine transformations in 2D

Type to represent a matrix, form is: [ [ a11, a12, a13 ] [ a21, a22, a23 ] [ a31, a32, a33 ] ]


Vec3 (a, a, a) 


Functor Vec3 
Eq a => Eq (Vec3 a) 
Show a => Show (Vec3 a) 

newtype Matrix3 a Source


Matrix3 (Vec3 (Vec3 a)) 


Functor Matrix3 
Eq a => Eq (Matrix3 a) 
Show a => Show (Matrix3 a) 

matrix3FromLists :: [[a]] -> Matrix3 aSource

Given a 3x3 matrix as a list of lists, convert it to a Matrix3

matrix3FromList :: [a] -> Matrix3 aSource

given a single list of 9 elements, construct a Matrix3

matrix3ToList :: Matrix3 a -> [a]Source

Gather the elements of the matrix in one long list (in row by row order)