Copyright | (c) 2011-2013 diagrams-lib team (see LICENSE) |
---|---|

License | BSD-style (see LICENSE) |

Maintainer | diagrams-discuss@googlegroups.com |

Safe Haskell | None |

Language | Haskell2010 |

- class Alignable a where
- alignBy' :: (HasOrigin a, AdditiveGroup (V a), Num (Scalar (V a)), Fractional (Scalar (V a))) => (V a -> a -> Point (V a)) -> V a -> Scalar (V a) -> a -> a
- defaultBoundary :: V a -> a -> Point (V a)
- alignBy :: (HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a))) => V a -> Scalar (V a) -> a -> a

- alignBy'Default :: (HasOrigin a, AdditiveGroup (V a), Num (Scalar (V a)), Fractional (Scalar (V a))) => (V a -> a -> Point (V a)) -> V a -> Scalar (V a) -> a -> a
- envelopeBoundary :: Enveloped a => V a -> a -> Point (V a)
- traceBoundary :: Traced a => V a -> a -> Point (V a)
- align :: (Alignable a, HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a))) => V a -> a -> a
- snug :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a) => V a -> a -> a
- centerV :: (Alignable a, HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a))) => V a -> a -> a
- center :: (HasLinearMap (V a), Alignable a, HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a))) => a -> a
- snugBy :: (Alignable a, Traced a, HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a))) => V a -> Scalar (V a) -> a -> a
- snugCenterV :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a) => V a -> a -> a
- snugCenter :: (HasLinearMap (V a), Alignable a, HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a)), Traced a) => a -> a

# Alignable class

class Alignable a where Source

Class of things which can be aligned.

alignBy' :: (HasOrigin a, AdditiveGroup (V a), Num (Scalar (V a)), Fractional (Scalar (V a))) => (V a -> a -> Point (V a)) -> V a -> Scalar (V a) -> a -> a Source

`alignBy v d a`

moves the origin of `a`

along the vector
`v`

. If `d = 1`

, the origin is moved to the edge of the
boundary in the direction of `v`

; if `d = -1`

, it moves to the
edge of the boundary in the direction of the negation of `v`

.
Other values of `d`

interpolate linearly (so for example, ```
d =
0
```

centers the origin along the direction of `v`

).

defaultBoundary :: V a -> a -> Point (V a) Source

alignBy :: (HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a))) => V a -> Scalar (V a) -> a -> a Source

(InnerSpace (V b), Ord (Scalar (V b)), Alignable b) => Alignable [b] | |

(InnerSpace (V b), Ord (Scalar (V b)), Alignable b) => Alignable (Set b) | |

(InnerSpace v, OrderedField (Scalar v)) => Alignable (Envelope v) | |

(InnerSpace v, OrderedField (Scalar v)) => Alignable (Trace v) | |

(InnerSpace v, OrderedField (Scalar v)) => Alignable (Path v) | |

(HasOrigin a, Alignable a) => Alignable (b -> a) | Although the |

(InnerSpace (V b), Ord (Scalar (V b)), Alignable b) => Alignable (Map k b) | |

(HasLinearMap v, InnerSpace v, OrderedField (Scalar v), Monoid' m) => Alignable (QDiagram b v m) |

alignBy'Default :: (HasOrigin a, AdditiveGroup (V a), Num (Scalar (V a)), Fractional (Scalar (V a))) => (V a -> a -> Point (V a)) -> V a -> Scalar (V a) -> a -> a Source

Default implementation of `alignBy`

for types with `HasOrigin`

and `AdditiveGroup`

instances.

envelopeBoundary :: Enveloped a => V a -> a -> Point (V a) Source

Some standard functions which can be used as the `boundary`

argument to
`alignBy'`

.

# General alignment functions

align :: (Alignable a, HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a))) => V a -> a -> a Source

`align v`

aligns an enveloped object along the edge in the
direction of `v`

. That is, it moves the local origin in the
direction of `v`

until it is on the edge of the envelope. (Note
that if the local origin is outside the envelope to begin with,
it may have to move "backwards".)

snug :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a) => V a -> a -> a Source

Like align but uses trace.

centerV :: (Alignable a, HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a))) => V a -> a -> a Source

`centerV v`

centers an enveloped object along the direction of
`v`

.

center :: (HasLinearMap (V a), Alignable a, HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a))) => a -> a Source

`center`

centers an enveloped object along all of its basis vectors.

snugBy :: (Alignable a, Traced a, HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a))) => V a -> Scalar (V a) -> a -> a Source

Version of `alignBy`

specialized to use `traceBoundary`

snugCenterV :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a) => V a -> a -> a Source

Like `centerV`

using trace.

snugCenter :: (HasLinearMap (V a), Alignable a, HasOrigin a, Num (Scalar (V a)), Fractional (Scalar (V a)), Traced a) => a -> a Source

Like `center`

using trace.