Module

Graphics.Isometric

Package
purescript-isometric
Repository
sharkdp/purescript-isometric

#Face Source

type Face = ThreeOrMore Point

A Face is a list of (at least) three points which all lie in a plane.

#Shape Source

type Shape = List Face

A Shape consists of several Faces.

#extrude Source

extrude :: ThreeOrMore Point -> Number -> Shape

Project a 2D path onto the xy plane and extrude it by the given height.

#extrudeCone Source

extrudeCone :: ThreeOrMore Point -> Number -> Shape

Create a cone-like object by extruding the points from a base path in the xy plane to a single point above (or below) it.

#prism Source

prism :: Point -> Number -> Number -> Number -> Shape

A prism, constructed from a given corner point and the width, height and depth (dimensions in x, y, and z-direction).

#cube Source

cube :: Point -> Number -> Shape

A cube is a prism with three equal sides.

#cone Source

cone :: Point -> Int -> Number -> Number -> Shape

A cone, determined by the center of the bottom face, the number of sides, the radius and the height.

#pyramid Source

pyramid :: Point -> Number -> Number -> Shape

A four-sided pyramid, determined by the center of the bottom face, the base length and the height.

#pyramid3 Source

pyramid3 :: Point -> Number -> Number -> Shape

A three-sided pyramid, determined by the center of the bottom face, the base length and the height.

#cylinder Source

cylinder :: Point -> Int -> Number -> Number -> Shape

A cylinder, determined by the center of the bottom face, the number of sides, the radius and the height.

#Scene Source

data Scene

Main data type for the description of a 3D isometric scene.

Constructors

Instances

#translateX Source

translateX :: Number -> Scene -> Scene

Translate a scene by a given offset in x-direction.

#translateY Source

translateY :: Number -> Scene -> Scene

Translate a scene by a given offset in y-direction.

#translateZ Source

translateZ :: Number -> Scene -> Scene

Translate a scene by a given offset in z-direction.

#rotateX Source

rotateX :: Angle -> Scene -> Scene

Rotate a scene around the x-axis.

#rotateY Source

rotateY :: Angle -> Scene -> Scene

Rotate a scene around the y-axis.

#rotateZ Source

rotateZ :: Angle -> Scene -> Scene

Rotate a scene around the z-axis.

#scale Source

scale :: Number -> Scene -> Scene

Scale a scene by a multiplicative factor (with respect to the origin).

#filled Source

filled :: Color -> Shape -> Scene

Fill a shape with a given base color. Individual faces can be brighter.

#renderScene Source

renderScene :: Vector -> Scene -> Drawing

Render a three-dimensional Scene into a two-dimensional Drawing, using an isometric projection. The vector determines the direction of light.

Re-exports from Color

#Color Source

data Color

The representation of a color.

Note:

  • The Eq instance compares two Colors by comparing their (integer) RGB values. This is different from comparing the HSL values (for example, HSL has many different representations of black (arbitrary hue and saturation values).
  • Colors outside the sRGB gamut which cannot be displayed on a typical computer screen can not be represented by Color.

Instances

Re-exports from Data.List.ThreeOrMore

#ThreeOrMore Source

#toList Source

toList :: forall a. ThreeOrMore a -> List a

#reverse Source

reverse :: forall a. ThreeOrMore a -> ThreeOrMore a

#last Source

last :: forall a. ThreeOrMore a -> a

Re-exports from Graphics.Isometric.Types

#Vector Source

type Vector = Point

A vector or direction.

#Point Source

type Point = { x :: Number, y :: Number, z :: Number }

A 3D point.

#Angle Source

type Angle = Number

An angle in radians.