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

Maintainer diagrams-discuss@googlegroups.com None

Diagrams.Query

Description

A query is a function that maps points in a vector space to values in some monoid. Queries naturally form a monoid, with two queries being combined pointwise.

Synopsis

# Documentation

newtype Query v m

A query is a function that maps points in a vector space to values in some monoid. Queries naturally form a monoid, with two queries being combined pointwise.

The idea for annotating diagrams with monoidal queries came from the graphics-drawingcombinators package, http://hackage.haskell.org/package/graphics-drawingcombinators.

Constructors

 Query FieldsrunQuery :: Point v -> m

Instances

 Action Name (Query v m) Functor (Query v) Applicative (Query v) Semigroup m => Semigroup (Query v m) Monoid m => Monoid (Query v m) HasLinearMap v => Transformable (Query v m) VectorSpace v => HasOrigin (Query v m) Wrapped (Point v -> m) (Point v' -> m') (Query v m) (Query v' m') Wrapped (DUALTree (DownAnnots v) (UpAnnots b v m) () (QDiaLeaf b v m)) (DUALTree (DownAnnots v') (UpAnnots b' v' m') () (QDiaLeaf b' v' m')) (QDiagram b v m) (QDiagram b' v' m')

query :: Monoid m => QDiagram b v m -> Query v m

Get the query function associated with a diagram.

sample :: Monoid m => QDiagram b v m -> Point v -> m

Sample a diagram's query function at a given point.

value :: Monoid m => m -> QDiagram b v Any -> QDiagram b v m

Set the query value for `True` points in a diagram (i.e. points "inside" the diagram); `False` points will be set to `mempty`.

resetValue :: (Eq m, Monoid m) => QDiagram b v m -> QDiagram b v Any

Reset the query values of a diagram to `True`/`False`: any values equal to `mempty` are set to `False`; any other values are set to `True`.

clearValue :: QDiagram b v m -> QDiagram b v Any

Set all the query values of a diagram to `False`.