For version 0.7.0.
To top.  Up: ..Shapes..Layout

[standard prelude]

basic-layout


Alphabetical index
bboxed_enlarge bboxed_sym bboxed_sym_x bboxed_sym_y center center_wlm center_x center_y centerof enlarge_bleedbox @labelmargin mediate mspoint xmax xmin ymax ymin

Namespace:  ..Shapes..Layout

The functions in this extension provide the basic means for layout.
Sections:    Extreme coordinates on paths    Basic positioning operations    Label margin    Mediation    Boxes

Extreme coordinates on paths

These functions optimize along paths in one of the four principal directions, returning the coordinate of the optimum.
xmax
p::§Path §Length
Dynamic references:none
Rightmost coordinate along p.
xmin
p::§Path §Length
Dynamic references:none
Leftmost coordinate along p.
ymax
p::§Path §Length
Dynamic references:none
Topmost coordinate along p.
ymin
p::§Path §Length
Dynamic references:none
Bottommost coordinate along p.

Basic positioning operations

center
obj::§Drawable z:(0,0)::§FloatPair §Drawable
Dynamic references:none
The argument z is interpreted as a point in the bounding box of obj, with (-1,-1) being the lower left corner, and (1,1) being the upper right corner. obj is then shifted so that this point ends up at the origin.
center_x
obj::§Drawable x:0::§Float §Drawable
Dynamic references:none
Like center, but operates only along the x axis.
center_y
obj::§Drawable y:0::§Float §Drawable
Dynamic references:none
Like center, but operates only along the y axis.
centerof
obj::§Drawable §Coords
Dynamic references:none
Returns the point which is mid-way between the extreme points of the bounding box in the x and y direction, respectively.

Label margin

When positioning text relative to other elements, it often looks good if labels appear at a certain distance from the objects they label. This idea is implemented as functions using a common dynamic variable.
@labelmargin
Used by:
Type:§Length
Default binding:1 mm
Distance to be used when placing labels relative to the point they label.
center_wlm
obj::§Drawable z::§FloatPair §Drawable
Dynamic references:
The argument z is interpreted as a point in the bounding box of obj, with (-1,-1) being the lower left corner, and (1,1) being the upper right corner. obj is then shifted so that this point ends up at the origin.

Mediation

By mediation we refer to the specification of a value relative to a lower and upper bound. The bounds can either be very general, or the beginning and end of a path.
mediate
r::§Float x1::§L x2::§L §L
§L  
Elements constitute a linear space, that is, they can be added and multiplied by scalars.
Dynamic references:none
Simply computes (1-r)*x1 + r*x2.
mspoint
pth::§Path mediation::§Float slide:0 cm::§Length §Coords
Dynamic references:none
Interprets mediation as a length relative the total length of pth, then adds slide to this length, and finds the coordinates at the computed arc time.
For instance, the geometric midpoint of a path myPath is obtained as [mspoint myPath 0.5].

Boxes

It is sometime useful to control the layout of an object by altering one or several of its boxes. At the moment, there are just two boxes, the bounding box and the bleed box, and for historical reasons, the short bbox refers to the bounding box.
bboxed_sym
obj::§Drawable §Drawable
Dynamic references:none
Enlarges the bounding box to a rectangle just big enough to obtain the center of the bounding box at the origin.
bboxed_sym_y
obj::§Drawable §Drawable
Dynamic references:none
Enlarges the bounding box to a rectangle just big enough to obtain the center of the bounding box at the y coordinate zero.
bboxed_sym_x
obj::§Drawable §Drawable
Dynamic references:none
Enlarges the bounding box to a rectangle just big enough to obtain the center of the bounding box at the x coordinate zero.
bboxed_enlarge
obj::§Drawable z::§Coords §Drawable
Dynamic references:none
Enlarges the bounding box in all four principal direction to a rectangle, the horizontal and vertical enlargements given by the corresponding coordinates of z.
enlarge_bleedbox
obj::§Drawable z::§Coords §Drawable
Dynamic references:none
Like bboxed_enlarge, but acting on the bleed box instead of the bounding box.
Get Shapes at SourceForge.net. Fast, secure and Free Open Source software downloads