implicit-0.4.0.0: A math-inspired programmatic 2D & 3D CAD system.
Safe HaskellNone
LanguageHaskell2010

Graphics.Implicit.Primitives

Synopsis

Documentation

translate Source #

Arguments

:: Object obj f a 
=> f a

Vector to translate by

-> obj

Object to translate

-> obj

Resulting object

Translate an object by a vector of appropriate dimension.

mirror Source #

Arguments

:: Object obj f a 
=> f a

Vector defining the hyperplane

-> obj

Object to mirror

-> obj

Resulting object

Mirror an object across the hyperplane whose normal is a given vector.

scale Source #

Arguments

:: Object obj f a 
=> f a

Amount to scale by

-> obj

Object to scale

-> obj

Resulting scaled object

Scale an object

outset Source #

Arguments

:: Object obj f a 
=>

distance to outset

-> obj

object to outset

-> obj

resulting object

Outset of an object.

complement Source #

Arguments

:: Object obj f a 
=> obj

Object to complement

-> obj

Result

Complement an Object

union :: Object obj f a => [obj] -> obj Source #

intersect :: Object obj f a => [obj] -> obj Source #

difference :: Object obj f a => obj -> [obj] -> obj Source #

unionR Source #

Arguments

:: Object obj f a 
=>

The radius (in mm) of rounding

-> [obj]

objects to union

-> obj

Resulting object

Rounded union

intersectR Source #

Arguments

:: Object obj f a 
=>

The radius (in mm) of rounding

-> [obj]

Objects to intersect

-> obj

Resulting object

Rounded minimum

differenceR Source #

Arguments

:: Object obj f a 
=>

The radius (in mm) of rounding

-> obj

Base object

-> [obj]

Objects to subtract from the base

-> obj

Resulting object

Rounded difference

shell Source #

Arguments

:: Object obj f a 
=>

width of shell

-> obj

object to take shell of

-> obj

resulting shell

Make a shell of an object.

getBox Source #

Arguments

:: Object obj f a 
=> obj

Object to get box of

-> (f a, f a)

Bounding box

Get the bounding box an object

getImplicit Source #

Arguments

:: Object obj f a 
=> obj

Object to get implicit function of

-> f a -> a

Implicit function

Get the implicit function for an object

getImplicit' Source #

Arguments

:: Object obj f a 
=> ObjectContext 
-> obj

Object to get implicit function of

-> f a -> a

Implicit function

Get the implicit function for an object

extrude Source #

Arguments

:: SymbolicObj2 
->

Extrusion height

-> SymbolicObj3 

Extrude a 2d object upwards. The current object-rounding value set by withRounding is used to round the caps, but is not used by the 2D object.

extrudeM Source #

Arguments

:: Either ( -> )

twist

-> ExtrudeMScale

scale

-> Either ℝ2 ( -> ℝ2)

translate

-> SymbolicObj2

object to extrude

-> Either (ℝ2 -> )

height to extrude to

-> SymbolicObj3 

The current object-rounding value set by withRounding is used to round the caps, but is not used by the 2D object.

sphere Source #

Arguments

::

Radius of the sphere

-> SymbolicObj3

Resulting sphere

cube Source #

Arguments

:: Bool

Centered?

-> ℝ3

Size

-> SymbolicObj3

Resuting cube. (0,0,0) is bottom left if center = False, otherwise it's the center.

A cube

rect3 Source #

Arguments

:: ℝ3

Bottom.. corner

-> ℝ3

Top right... corner

-> SymbolicObj3

Resuting cube

A rectangular prism

circle Source #

Arguments

::

radius of the circle

-> SymbolicObj2

resulting circle

cylinder Source #

Arguments

::

Radius of the cylinder

->

Height of the cylinder

-> SymbolicObj3

Resulting cylinder

cylinder2 Source #

Arguments

::

Radius of the cylinder

->

Second radius of the cylinder

->

Height of the cylinder

-> SymbolicObj3

Resulting cylinder

A conical frustum --- ie. a cylinder with different radii at either end.

square Source #

Arguments

:: Bool

Centered?

-> ℝ2

Size

-> SymbolicObj2

Resulting square (bottom right = (0,0) )

A square

rect Source #

Arguments

:: ℝ2

Bottom left corner

-> ℝ2

Top right corner

-> SymbolicObj2

Resulting square

A rectangle

polygon Source #

Arguments

:: [ℝ2]

Verticies of the polygon

-> SymbolicObj2

Resulting polygon

A 2D polygon

rotateExtrude Source #

Arguments

::

Angle to sweep to (in rad)

-> Either ℝ2 ( -> ℝ2)

translate

-> Either ( -> )

rotate

-> SymbolicObj2

object to extrude

-> SymbolicObj3 

rotate3 :: ℝ3 -> SymbolicObj3 -> SymbolicObj3 Source #

Rotate a 3D object via an Euler angle, measured in radians, along the world axis.

rotate3V Source #

Arguments

::

Angle of rotation

-> ℝ3

Axis of rotation

-> SymbolicObj3 
-> SymbolicObj3 

Rotate a 3D object along an arbitrary axis.

transform3 :: M44 -> SymbolicObj3 -> SymbolicObj3 Source #

Transform a 3D object using a 4x4 matrix representing affine transformation (OpenSCAD multmatrix)

pack3 Source #

Arguments

:: ℝ2

Area to pack

->

Separation between objects

-> [SymbolicObj3]

Objects to pack

-> Maybe SymbolicObj3

Just if the objects could be packed into the given area

Attempt to pack multiple 3D objects into a fixed area. The z coordinate of each object is dropped, and the resulting packed objects will all be on the same plane.

FIXME: shouldn't this pack into a 3d area, or have a 3d equivalent?

transform :: M33 -> SymbolicObj2 -> SymbolicObj2 Source #

Transform a 2D object using a 3x3 matrix representing affine transformation (OpenSCAD multmatrix)

pack2 Source #

Arguments

:: ℝ2

Area to pack

->

Separation between objects

-> [SymbolicObj2]

Objects to pack

-> Maybe SymbolicObj2

Just if the objects could be packed into the given area

Attempt to pack multiple 2D objects into a fixed area.

implicit Source #

Arguments

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

Implicit function

-> (f a, f a)

Bounding box

-> obj

Resulting object

emptySpace :: Object obj f a => obj Source #

The object that fills no space

fullSpace :: Object obj f a => obj Source #

The object that fills the entire space

withRounding :: Object obj f a => -> obj -> obj Source #

Set the current object-rounding value for the given object. The rounding value is measured in units of distance, and describes the radius of rounded corners.

This can be used to change the shape of more primitive forms, for example, we can make a cube with rounded corners via withRounding 5 (cube True 20).

withRounding r obj applies the rounding r all primitives objects in obj, so long as they have the same dimensionality. That is to say, the current object-rounding value set in 3D will not apply to extruded 2D shapes.

_Shared :: Object obj f a => Prism' obj (SharedObj obj f a) Source #

A Prism' for including SharedObjs in obj. Prefer using Shared instead of this.

pattern Shared :: Object obj f a => SharedObj obj f a -> obj Source #

A pattern that abstracts over Shared2 and Shared3.

class (Applicative f, Eq a, Eq (f a), Num a, Num (f a)) => Object obj f a | obj -> f a Source #

Operations available on both 2D and 3D objects. The obvious omission of rotation operations from this class are a technical limitation, and are instead provided by rotate and rotate3.

Library users shouldn't need to provide new instances of this class.

Minimal complete definition

_Shared, getBox, getImplicit'