implicit-0.4.1.0: A math-inspired programmatic 2D & 3D CAD system.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Graphics.Implicit.Canon

Description

This module implements canonicalization pass that * eliminates identities * merges consecutive transformations like transform . transform into one * prevents invalid transformations like scaling by zero that would otherwise result in NaNs down the pipe * turns degenerate objects into empty space (i.e. circle 0, cube (pure 0))

Synopsis

Documentation

canonicalize2 :: SymbolicObj2 -> SymbolicObj2 Source #

Canonicalize SymbolicObj2 tree

canonicalize3 :: SymbolicObj3 -> SymbolicObj3 Source #

Canonicalize SymbolicObj3 tree

fmapObj2 Source #

Arguments

:: (SymbolicObj2 -> SymbolicObj2)

SymbolicObj2 transformation

-> (SymbolicObj3 -> SymbolicObj3)

SymbolicObj3 transformation

-> (forall obj f a. Object obj f a => obj -> obj)

Shared2|3 transformation

-> SymbolicObj2 
-> SymbolicObj2 

Map over SymbolicObj2 and its underlying shared objects

This function is co-recursive with fmapSharedObj to achieve deep mapping over objects nested in Shared2 constructor

fmapObj3 Source #

Arguments

:: (SymbolicObj3 -> SymbolicObj3)

SymbolicObj3 transformation

-> (SymbolicObj2 -> SymbolicObj2)

SymbolicObj2 transformation

-> (forall obj f a. Object obj f a => obj -> obj)

Shared2|3 transformation

-> SymbolicObj3 
-> SymbolicObj3 

Map over SymbolicObj3 and its underlying shared objects

This function is co-recursive with fmapSharedObj to achieve deep mapping over objects nested in Shared3 constructor

fmapSharedObj :: forall obj f a. Object obj f a => (obj -> obj) -> (obj -> obj) -> obj -> obj Source #

Map over SharedObj and its underlying objects

This resembles bimap from Bifunctor but the structure of SharedObj doesn't allow us to define Bifunctor instance as we need to map over the first type argument (obj) and not f and a.

rewriteUntilIrreducible Source #

Arguments

:: (Object obj f a, EqObj obj) 
=> (obj -> obj)

SymbolicObjN transformation

-> obj 
-> obj 

Rewrite the object tree until it cannot be reduced further

class EqObj a where Source #

We have to define our own variant of Eq which compares objects when possible and returns True when we cannot compare things like functions

Methods

(=^=) :: a -> a -> Bool Source #

Instances

Instances details
EqObj ExtrudeMScale Source # 
Instance details

Defined in Graphics.Implicit.Canon

EqObj SymbolicObj2 Source # 
Instance details

Defined in Graphics.Implicit.Canon

EqObj SymbolicObj3 Source # 
Instance details

Defined in Graphics.Implicit.Canon

EqObj a => EqObj [a] Source # 
Instance details

Defined in Graphics.Implicit.Canon

Methods

(=^=) :: [a] -> [a] -> Bool Source #

(EqObj obj, Eq (f a)) => EqObj (SharedObj obj f a) Source # 
Instance details

Defined in Graphics.Implicit.Canon

Methods

(=^=) :: SharedObj obj f a -> SharedObj obj f a -> Bool Source #