diagrams-lib-1.4.3: Embedded domain-specific language for declarative graphics

Copyright | (c) 2011 diagrams-lib team (see LICENSE)
License | BSD-style (see LICENSE)
Maintainer | diagrams-discuss@googlegroups.com
Safe Haskell | None
Language | Haskell2010

Diagrams.ThreeD.Shapes

Contents

- Skinned class
- Basic 3D shapes
- Constructive solid geometry

Description

Various three-dimensional shapes.

Synopsis

- class Skinned t where
  - skin :: (Renderable t b, N t ~ n, TypeableFloat n) => t -> QDiagram b V3 n Any
- data Ellipsoid n = Ellipsoid (Transformation V3 n)
- sphere :: Num n => Ellipsoid n
- data Box n = Box (Transformation V3 n)
- cube :: Num n => Box n
- data Frustum n = Frustum n n (Transformation V3 n)
- frustum :: Num n => n -> n -> Frustum n
- cone :: Num n => Frustum n
- cylinder :: Num n => Frustum n
- data CSG n
  - = CsgEllipsoid (Ellipsoid n)
  - | CsgBox (Box n)
  - | CsgFrustum (Frustum n)
  - | CsgUnion [CSG n]
  - | CsgIntersection [CSG n]
  - | CsgDifference (CSG n) (CSG n)
- union :: (CsgPrim a, CsgPrim b) => a n -> b n -> CSG n
- intersection :: (CsgPrim a, CsgPrim b) => a n -> b n -> CSG n
- difference :: (CsgPrim a, CsgPrim b) => a n -> b n -> CSG n

# Skinned class

class Skinned t where Source #

Types which can be rendered as 3D Diagrams.

Methods

skin :: (Renderable t b, N t ~ n, TypeableFloat n) => t -> QDiagram b V3 n Any Source #

#### Instances

Instances details

(RealFloat n, Ord n) => Skinned (CSG n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods skin :: (Renderable (CSG n) b, N (CSG n) ~ n0, TypeableFloat n0) => CSG n -> QDiagram b V3 n0 Any Source #
Skinned (Frustum n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods skin :: (Renderable (Frustum n) b, N (Frustum n) ~ n0, TypeableFloat n0) => Frustum n -> QDiagram b V3 n0 Any Source #
OrderedField n => Skinned (Box n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods skin :: (Renderable (Box n) b, N (Box n) ~ n0, TypeableFloat n0) => Box n -> QDiagram b V3 n0 Any Source #
OrderedField n => Skinned (Ellipsoid n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods skin :: (Renderable (Ellipsoid n) b, N (Ellipsoid n) ~ n0, TypeableFloat n0) => Ellipsoid n -> QDiagram b V3 n0 Any Source #

# Basic 3D shapes

data Ellipsoid n Source #

Constructors

Ellipsoid (Transformation V3 n) |

#### Instances

Instances details

OrderedField n => Enveloped (Ellipsoid n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getEnvelope :: Ellipsoid n -> Envelope (V (Ellipsoid n)) (N (Ellipsoid n)) Source #
OrderedField n => Traced (Ellipsoid n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getTrace :: Ellipsoid n -> Trace (V (Ellipsoid n)) (N (Ellipsoid n)) Source #
Fractional n => Transformable (Ellipsoid n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods transform :: Transformation (V (Ellipsoid n)) (N (Ellipsoid n)) -> Ellipsoid n -> Ellipsoid n Source #
OrderedField n => Skinned (Ellipsoid n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods skin :: (Renderable (Ellipsoid n) b, N (Ellipsoid n) ~ n0, TypeableFloat n0) => Ellipsoid n -> QDiagram b V3 n0 Any Source #
Fractional n => Renderable (Ellipsoid n) NullBackend Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods render :: NullBackend -> Ellipsoid n -> Render NullBackend (V (Ellipsoid n)) (N (Ellipsoid n)) Source #
(Num n, Ord n) => HasQuery (Ellipsoid n) Any Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getQuery :: Ellipsoid n -> Query (V (Ellipsoid n)) (N (Ellipsoid n)) Any Source #
type V (Ellipsoid n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes type V (Ellipsoid n) = V3
type N (Ellipsoid n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes type N (Ellipsoid n) = n

sphere :: Num n => Ellipsoid n Source #

A sphere of radius 1 with its center at the origin.

data Box n Source #

Constructors

Box (Transformation V3 n) |

#### Instances

Instances details

OrderedField n => Enveloped (Box n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getEnvelope :: Box n -> Envelope (V (Box n)) (N (Box n)) Source #
(Fractional n, Ord n) => Traced (Box n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getTrace :: Box n -> Trace (V (Box n)) (N (Box n)) Source #
Fractional n => Transformable (Box n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods transform :: Transformation (V (Box n)) (N (Box n)) -> Box n -> Box n Source #
OrderedField n => Skinned (Box n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods skin :: (Renderable (Box n) b, N (Box n) ~ n0, TypeableFloat n0) => Box n -> QDiagram b V3 n0 Any Source #
Fractional n => Renderable (Box n) NullBackend Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods render :: NullBackend -> Box n -> Render NullBackend (V (Box n)) (N (Box n)) Source #
(Num n, Ord n) => HasQuery (Box n) Any Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getQuery :: Box n -> Query (V (Box n)) (N (Box n)) Any Source #
type V (Box n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes type V (Box n) = V3
type N (Box n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes type N (Box n) = n

cube :: Num n => Box n Source #

A cube with side length 1, in the positive octant, with one vertex at the origin.

data Frustum n Source #

Constructors

Frustum n n (Transformation V3 n) |

#### Instances

Instances details

(OrderedField n, RealFloat n) => Enveloped (Frustum n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getEnvelope :: Frustum n -> Envelope (V (Frustum n)) (N (Frustum n)) Source #
(RealFloat n, Ord n) => Traced (Frustum n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getTrace :: Frustum n -> Trace (V (Frustum n)) (N (Frustum n)) Source #
Fractional n => Transformable (Frustum n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods transform :: Transformation (V (Frustum n)) (N (Frustum n)) -> Frustum n -> Frustum n Source #
Skinned (Frustum n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods skin :: (Renderable (Frustum n) b, N (Frustum n) ~ n0, TypeableFloat n0) => Frustum n -> QDiagram b V3 n0 Any Source #
Fractional n => Renderable (Frustum n) NullBackend Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods render :: NullBackend -> Frustum n -> Render NullBackend (V (Frustum n)) (N (Frustum n)) Source #
OrderedField n => HasQuery (Frustum n) Any Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getQuery :: Frustum n -> Query (V (Frustum n)) (N (Frustum n)) Any Source #
type V (Frustum n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes type V (Frustum n) = V3
type N (Frustum n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes type N (Frustum n) = n

frustum :: Num n => n -> n -> Frustum n Source #

A frustum of a right circular cone. It has height 1 oriented along the positive z axis, and radii r0 and r1 at Z=0 and Z=1. `cone` and `cylinder` are special cases.

cone :: Num n => Frustum n Source #

A cone with its base centered on the origin, with radius 1 at the base, height 1, and it's apex on the positive Z axis.

cylinder :: Num n => Frustum n Source #

A circular cylinder of radius 1 with one end cap centered on the origin, and extending to Z=1.

# Constructive solid geometry

data CSG n Source #

A tree of Constructive Solid Geometry operations and the primitives that can be used in them.

Constructors

CsgEllipsoid (Ellipsoid n) |
CsgBox (Box n) |
CsgFrustum (Frustum n) |
CsgUnion [CSG n] |
CsgIntersection [CSG n] |
CsgDifference (CSG n) (CSG n) |

#### Instances

Instances details

RealFloat n => Enveloped (CSG n) Source # | The Envelope for an Intersection or Difference is simply the Envelope of the Union. This is wrong but easy to implement.
Instance details Defined in Diagrams.ThreeD.Shapes Methods getEnvelope :: CSG n -> Envelope (V (CSG n)) (N (CSG n)) Source #
(RealFloat n, Ord n) => Traced (CSG n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getTrace :: CSG n -> Trace (V (CSG n)) (N (CSG n)) Source #
Fractional n => Transformable (CSG n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods transform :: Transformation (V (CSG n)) (N (CSG n)) -> CSG n -> CSG n Source #
(RealFloat n, Ord n) => Skinned (CSG n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods skin :: (Renderable (CSG n) b, N (CSG n) ~ n0, TypeableFloat n0) => CSG n -> QDiagram b V3 n0 Any Source #
(Floating n, Ord n) => HasQuery (CSG n) Any Source # |
Instance details Defined in Diagrams.ThreeD.Shapes Methods getQuery :: CSG n -> Query (V (CSG n)) (N (CSG n)) Any Source #
type V (CSG n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes type V (CSG n) = V3
type N (CSG n) Source # |
Instance details Defined in Diagrams.ThreeD.Shapes type N (CSG n) = n

union :: (CsgPrim a, CsgPrim b) => a n -> b n -> CSG n Source #

intersection :: (CsgPrim a, CsgPrim b) => a n -> b n -> CSG n Source #

difference :: (CsgPrim a, CsgPrim b) => a n -> b n -> CSG n Source #