-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Cubic DSL for 3D printing -- @package cube @version 0.2.0 module Language.Cube -- | Ristricted STL This is the almost same as STL of Graphics.Formats.STL. -- This is used to instantiate RFunctor of STL. RFunctor provides a -- function(rfmap) like fmap of Functor. data RSTL a Stl :: STL -> RSTL a stlData :: RSTL a -> STL -- | Wrapper of RSTL type Stl = RSTL Triangle -- | Generate Ristricted STL class ToStl a toStl :: ToStl a => a -> Stl -- | class type of mathematical conjugate class Conjugate a conjugate :: Conjugate a => a -> a -- | Delta move and rotation for quaternion class Num a => Delta a where rotate = dR dx :: Delta a => a dy :: Delta a => a dz :: Delta a => a ds :: Delta a => a dr :: Delta a => Float -> a -> a dR :: Delta a => Float -> a -> a -> a rotate :: Delta a => Float -> a -> a -> a -- | Ristricted Functor class RFunctor f a b rfmap :: RFunctor f a b => (a -> b) -> f a -> f b -- | Unit element of Cube. -- -- This is the same as quaternion. data Quaternion a Quaternion :: a -> a -> a -> a -> Quaternion a us :: Quaternion a -> a ux :: Quaternion a -> a uy :: Quaternion a -> a uz :: Quaternion a -> a type Cube = Quaternion Float -- | Set of Cube. This supports boolean operations on polygons. (+) means -- or. (-) means not. (*) means convolution. data Block a Block :: Set a -> Block a units :: Block a -> Set a -- | Generate STL from Ristricted STL toSTL :: ToStl a => a -> STL -- | Utility function of generating Cube from list of Int toCube :: [Int] -> Cube -- | Utility function of generating Block from list of cube block :: Ord a => [a] -> Block a -- | Utility function of Cube 0 x y z cube :: Int -> Int -> Int -> Cube -- | Remove redundant triangles compaction :: Stl -> Stl -- | Flip rotation of triangle flipTriangle :: Triangle -> Triangle -- | Generate binary STL file from Block writeFileStl :: ToStl a => String -> a -> IO () -- | Generate text STL file from Block writeFileStlWithText :: ToStl a => String -> a -> IO () -- | Print triangles of STL printStl :: ToStl a => a -> IO () -- | This function genrates a cube of n-width. nCube :: Int -> Block Cube -- | Generate surface block. This is fast function. But shape becomes -- little bit bigger. surface' :: Block Cube -> Block Cube -- | Generate surface block surface :: Block Cube -> Block Cube instance [incoherent] Show Triangle instance [incoherent] Eq Triangle instance [incoherent] Ord Triangle instance [incoherent] Show a => Show (Quaternion a) instance [incoherent] Eq a => Eq (Quaternion a) instance [incoherent] Ord a => Ord (Quaternion a) instance [incoherent] Show a => Show (Block a) instance [incoherent] Eq a => Eq (Block a) instance [incoherent] Ord a => Ord (Block a) instance [incoherent] (Ord a, Monoid a) => Monoid (Block a) instance [incoherent] ToStl a => ToStl (Block a) instance [incoherent] ToStl Cube instance [incoherent] Monoid Stl instance [incoherent] Monoid STL instance [incoherent] ToStl Stl instance [incoherent] ToStl STL instance [incoherent] Num Stl instance [incoherent] Num STL instance [incoherent] (Ord a, Ord b) => RFunctor Block a b instance [incoherent] (Ord a, Eq a, Num a) => Num (Block a) instance [incoherent] Num a => Num (Quaternion a) instance [incoherent] Num a => Monoid (Quaternion a) instance [incoherent] Delta Cube instance [incoherent] Num a => Conjugate (Quaternion a) instance [incoherent] Functor Quaternion instance [incoherent] RFunctor RSTL Triangle Triangle instance [incoherent] Functor m => RFunctor m a b instance [incoherent] (Ord a, Ord b) => RFunctor Set a b