Copyright | (c) 2012 Michael Sloan |
---|---|
License | BSD-style (see the LICENSE file) |
Maintainer | Michael Sloan <mgsloan at gmail> |
Safe Haskell | None |
Language | Haskell2010 |
An algorithm for filling space in a fashion akin to word-wrapping.
- wrapDiagram :: (Metric v, OrderedField n) => ([(v n, QDiagram b v n Any)], [QDiagram b v n Any]) -> QDiagram b v n Any
- wrapOutside :: (Enveloped a, V a ~ v, N a ~ n, Epsilon n) => (Point v n -> Bool) -> [v n] -> Point v n -> [a] -> ([(v n, a)], [a])
- wrapInside :: forall a v n. (Enveloped a, V a ~ v, N a ~ n, Metric v, OrderedField n, Epsilon n) => (Point v n -> Bool) -> [v n] -> Point v n -> [a] -> ([(v n, a)], [a])
Documentation
wrapDiagram :: (Metric v, OrderedField n) => ([(v n, QDiagram b v n Any)], [QDiagram b v n Any]) -> QDiagram b v n Any Source #
wrapDiagram
post-processes the results of wrapOutside
/
wrapInside
into a Diagram of the result. This only works when
applying them to a list of diagrams.
wrapOutside :: (Enveloped a, V a ~ v, N a ~ n, Epsilon n) => (Point v n -> Bool) -> [v n] -> Point v n -> [a] -> ([(v n, a)], [a]) Source #
wrapOutside
is the same as wrapInside
, but with an inverted
predicate.
wrapInside :: forall a v n. (Enveloped a, V a ~ v, N a ~ n, Metric v, OrderedField n, Epsilon n) => (Point v n -> Bool) -> [v n] -> Point v n -> [a] -> ([(v n, a)], [a]) Source #
wrapInside
greedily wraps content to fill a space defined by a
predicate. It is passed a list of vectors which express the
order of dimensions to be filled. In other words, wrapping RTL
text is done by passing in [unitX, unitY], to first exhaust
space horizontally, and then vertically.
Note that this function does not guarantee that there are not points inside each positioned item for which the predicate is False. Instead, only the corners of the bounds, along each axii, are used.