| Copyright | (c) 2013 diagrams-lib team (see LICENSE) |
|---|---|
| License | BSD-style (see LICENSE) |
| Maintainer | diagrams-discuss@googlegroups.com |
| Safe Haskell | None |
| Language | Haskell2010 |
Diagrams.Query
Contents
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
- newtype Query (v :: Type -> Type) n m = Query {}
- class HasQuery t m | t -> m where
- sample :: HasQuery t m => t -> Point (V t) (N t) -> m
- inquire :: HasQuery t Any => t -> Point (V t) (N t) -> Bool
- query :: forall m b (v :: Type -> Type) n. Monoid m => QDiagram b v n m -> Query v n m
- value :: Monoid m => m -> QDiagram b v n Any -> QDiagram b v n m
- resetValue :: (Eq m, Monoid m) => QDiagram b v n m -> QDiagram b v n Any
- clearValue :: QDiagram b v n m -> QDiagram b v n Any
Queries
newtype Query (v :: Type -> Type) n 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.
Instances
class HasQuery t m | t -> m where Source #
Types which can answer a Query about points inside the geometric
object.
If t and m are both a Semigroups, getQuery should satisfy
getQuery(t1 <> t2) =getQueryt1 <>getQueryt2
Instances
| (Floating n, Ord n) => HasQuery (CSG n) Any Source # | |
| OrderedField n => HasQuery (Frustum n) Any Source # | |
| (Num n, Ord n) => HasQuery (Box n) Any Source # | |
| (Num n, Ord n) => HasQuery (Ellipsoid n) Any Source # | |
| RealFloat n => HasQuery (Located (Trail V2 n)) Crossings Source # | |
| RealFloat n => HasQuery (Located (Trail' l V2 n)) Crossings Source # | |
| RealFloat n => HasQuery (Clip n) All Source # | A point inside a clip if the point is in |
| RealFloat n => HasQuery (Path V2 n) Crossings Source # | |
| RealFloat n => HasQuery (DImage n a) Any Source # | |
| (Additive v, Foldable v, Ord n) => HasQuery (BoundingBox v n) Any Source # | |
Defined in Diagrams.BoundingBox Methods getQuery :: BoundingBox v n -> Query (V (BoundingBox v n)) (N (BoundingBox v n)) Any Source # | |
| HasQuery (Query v n m) m Source # | |
| Monoid m => HasQuery (QDiagram b v n m) m Source # | |
Queries on diagrams
query :: forall m b (v :: Type -> Type) n. Monoid m => QDiagram b v n m -> Query v n m #
Get the query function associated with a diagram.