cube-0.2.0: Cubic DSL for 3D printing

Safe HaskellNone
LanguageHaskell2010

Language.Cube

Synopsis

Documentation

data RSTL a Source

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.

Constructors

Stl 

Fields

stlData :: STL
 

type Stl = RSTL Triangle Source

Wrapper of RSTL

class ToStl a where Source

Generate Ristricted STL

Methods

toStl :: a -> Stl Source

Instances

class Conjugate a where Source

class type of mathematical conjugate

Methods

conjugate :: a -> a Source

Instances

class Num a => Delta a where Source

Delta move and rotation for quaternion

Minimal complete definition

dx, dy, dz, ds, dr, dR

Methods

dx :: a Source

delta for x axis

dy :: a Source

delta for y axis

dz :: a Source

delta for z axis

ds :: a Source

delta for real part of quaternion

dr Source

Arguments

:: Float

radian

-> a

axes of routation

-> a 

cons (theta2) + i sin (theta2) + j sin (theta2) + k sin (theta2) of quaternion

dR Source

Arguments

:: Float

radian

-> a

axes of routation

-> a

Input Vector

-> a 

Routation for quaternion

rotate Source

Arguments

:: Float

radian

-> a

axes of routation

-> a

Input Vector

-> a 

Routation for quaternion This is the same as dR.

Instances

class RFunctor f a b where Source

Ristricted Functor

Methods

rfmap :: (a -> b) -> f a -> f b Source

Instances

Functor m => RFunctor m a b 
(Ord a, Ord b) => RFunctor Set a b

Functor of Set

(Ord a, Ord b) => RFunctor Block a b 
RFunctor RSTL Triangle Triangle 

data Quaternion a Source

Unit element of Cube.

This is the same as quaternion.

Constructors

Quaternion 

Fields

us :: a
 
ux :: a
 
uy :: a
 
uz :: a
 

Instances

data Block a Source

Set of Cube. This supports boolean operations on polygons. (+) means or. (-) means not. (*) means convolution.

Constructors

Block 

Fields

units :: Set a
 

Instances

(Ord a, Ord b) => RFunctor Block a b 
Eq a => Eq (Block a) 
(Ord a, Eq a, Num a) => Num (Block a) 
Ord a => Ord (Block a) 
Show a => Show (Block a) 
(Ord a, Monoid a) => Monoid (Block a) 
ToStl a => ToStl (Block a) 

toSTL :: ToStl a => a -> STL Source

Generate STL from Ristricted STL

toCube :: [Int] -> Cube Source

Utility function of generating Cube from list of Int

block :: Ord a => [a] -> Block a Source

Utility function of generating Block from list of cube

cube :: Int -> Int -> Int -> Cube Source

Utility function of Cube 0 x y z

compaction :: Stl -> Stl Source

Remove redundant triangles

flipTriangle :: Triangle -> Triangle Source

Flip rotation of triangle

writeFileStl :: ToStl a => String -> a -> IO () Source

Generate binary STL file from Block

writeFileStlWithText :: ToStl a => String -> a -> IO () Source

Generate text STL file from Block

printStl :: ToStl a => a -> IO () Source

Print triangles of STL

nCube :: Int -> Block Cube Source

This function genrates a cube of n-width.

surface' :: Block Cube -> Block Cube Source

Generate surface block. This is fast function. But shape becomes little bit bigger.

surface :: Block Cube -> Block Cube Source

Generate surface block