Version: 5.2.1
distribute: Distributing picts across paths in Slideshow
Jacob Matthews
jacobm at gmail
The distribute library provides a simple way of distributing a series of picts evenly across a path in a Slideshow presentation.
The path can be a line between two existing picts or arbitrary points, or it can be a general curve.
This document contains API reference. For an introduction,
(require (planet jacobm/distribute:1:0/distribute-examples))
for a slideshow that demonstrates this package’s features.
1 API Reference
(distribute-between | | origin | | | | destination | | | | scene | | | | picts | | | [ | #:origin-locator find-origin-pt | | | | #:destination-locator find-destination-pt | | | | #:rotate rotate?]) | |
|
→ pict? |
origin : pict? |
destination : pict? |
scene : pict? |
picts : (listof (or/c pict? (-> real? pict?))) |
|
|
rotate? : boolean? = #f |
Returns a pict whose bounding box is the same as scene, but with the picts described in picts
distributed evenly between the points designated by (find-origin-pt scene origin) and (find-destination-pt scene destination).
Values for which pict? returns true will be placed in an appropriate position along the path from
origin to destination. If #:rotate is true, then each pict will be rotated to
point in the direction that an object in its position would be pointing if it were travelling from
origin to destination. Functions provided in picts will be provided an appropriate
angle and expected to produce an appropriate pict for the given rotation. (These functions are provided a
rotation regardless of whether #:rotate is set to true or not.)
Represents a path described by two functions from some abstract
t value to
x and
y
coordinates using the functions
fx and
fy, respectively, where
t ranges from
min to
max. The
x and
y coordinates determine the overall size and layout
of the path, but not an absolute position on the screen (which is determined by picts produced by the path
using the same tools used to lay out all picts).
(path-between | | origin | | | | | | | destination | | | | | | | scene | | | | | | [ | #:origin-locator find-origin-pt | | | | | | | #:destination-locator find-destination-pt]) | | → | | pth? |
|
origin : pict? |
destination : pict? |
scene : pict? |
|
|
Returns the path between (find-origin-pt scene origin) and (find-destination-pt scene destination).
(distribute | | path | | | | | | | picts | | | | | | [ | #:divide divide | | | | | | | #:rotate rotate?]) | | → | | pict? |
|
path : pth? |
picts : (listof (or/c pict? (-> real? pict?))) |
| divide | | : | | (symbols 'evenly-across-domain 'evenly-across-range) | | | | = | | 'evenly-across-range |
|
rotate? : boolean? = #f |
Produces a pict of each pict in
picts distributed across the path described by
path. The supplied picts
or functions are rotated as described in the documentation for
distribute-between, above. If
#:divide is set to
'evenly-across-domain, then picts are laid out by dividing
t in equal increments
from
(pth-min path) to
(pth-max path); otherwise picts are placed equal arc-lengths apart across the path.