@defaultunit | |
---|---|
Used by: | |
Type: | §Length |
Default binding: | 50 cm |
Default unit of unspecified radii of polar coordinates used in path construction. Typically, the unit is set to a special length rather than a fixed distance. See ../syntax.html for details on special lengths.
It is not possible to refer to directly to the value of — the dynamic variable can be bound like any other dynamic variable, but will only be used implicitly during path construction.
|
coords | |
---|---|
::§Float ::§Float → §FloatPair | |
Dynamic references: | none |
Implements float-pair.
| |
::§LengthLike ::§LengthLike → §Coords | |
Dynamic references: | none |
Implements coords-2D.
One of the arguments is allowed to be the special §Float value zero, which is interpreted as a zero absolute length.
|
cornercoords | |
---|---|
::§LengthLike ::§LengthLike ::§Float → §Coords | |
Dynamic references: | none |
Implements corner-point-2D.
|
polarhandleFree_r | |
---|---|
::§Float → §PolarHandle | |
Dynamic references: | none |
Implements polar-handle-2D in the case when the modulus of the handle is not specified.
|
polarhandleFree_ra | |
---|---|
→ §PolarHandle | |
Dynamic references: | none |
Implements polar-handle-2D in the case when neither modulus nor angle of the handle is not specified.
|
angle | |
---|---|
::§FloatPair → §Float | |
Dynamic references: | none |
Angle to the point from the origin, measured counter-clockwise from the positive x axis. | |
::§Coords → §Float | |
Dynamic references: | none |
Analogous to the §FloatPair case. |
dir | |
---|---|
::§Float → §FloatPair | |
Dynamic references: | none |
Unit vector with given angle. |
normalized |
Scaling to unit length is closely related to computing the norm, compare . While the norm preserves physical units, scaling to unit norm will cancel the unit so that the produced unit vector is always unit-less.
|
---|---|
::§FloatPair → §FloatPair | |
Dynamic references: | none |
Scaling to unit length. The argument must not have zero length. | |
::§Coords → §FloatPair | |
Dynamic references: | none |
Scaling to unit length. The argument must not have zero length. | |
::§FloatTriple → §FloatTriple | |
Dynamic references: | none |
Scaling to unit length. The argument must not have zero length. | |
::§Coords3D → §FloatTriple | |
Dynamic references: | none |
Scaling to unit length. The argument must not have zero length. | |
::§Float → §Float | |
Dynamic references: | none |
Scaling to unit length, resulting in either plus or minus one. The argument must not be zero. | |
::§Integer → §Integer | |
Dynamic references: | none |
Scaling to unit length, resulting in either plus or minus one. The argument must not be zero. | |
::§Length → §Float | |
Dynamic references: | none |
Scaling to unit length, resulting in either plus or minus one. The argument must not be the zero length. |
orthogonal | |
---|---|
::§FloatPair → §FloatPair | |
Dynamic references: | none |
Produces vector which is orthogonal to the given one, by rotating 90° counter-clockwise.
|
emptypath | |
---|---|
Type: | §Path |
An empty 2d path. Useful in folds, for instance.
| |
See also: | ..Shapes..Geometry3D..emptypath |
duration | |
---|---|
::§Path → §Integer | |
Dynamic references: | none |
Index of the final pathpoint along the path (indexing starting from zero at the beginning of the path). On a closed path, this is the same as the total number of pathpoints. On an open path, it is one less.
| |
::§Path3D → §Integer | |
Dynamic references: | none |
Analogous to the the 2d case.
|
reverse | |
---|---|
::§Path → §Path | |
Dynamic references: | none |
Construct path where the order of pathpoints in the representation is reversed. The constructed path looks identical to the original.
| |
::§Path3D → §Path3D | |
Dynamic references: | none |
Analogous to the the 2d case.
|
winding | |
---|---|
path::§Path origin::§Coords → §Integer | |
Dynamic references: | none |
Counts the number of counter-clockwise turns that path makes about origin. It is required that path be closed.
The winding number is used to define filling and clipping.
| |
See also: | ..Shapes..Graphics..fill ..Shapes..Graphics..fillodd ..Shapes..Graphics..clip ..Shapes..Graphics..clipodd |
affinetransform | |
---|---|
::§FloatPair ::§FloatPair ::§Coords → §Transform | |
Dynamic references: | none |
Construct transform from multiplier for x and y coordinates, followed by a shift. |
shift | |
---|---|
::§Coords → §Transform | |
Dynamic references: | none |
Construct transform. |
rotate | |
---|---|
angle::§Float → §Transform | |
Dynamic references: | none |
Construct transform. |
scale | |
---|---|
r:1::§Float x:1::§Float y:1::§Float → §Transform | |
Dynamic references: | none |
Construct transform that scales x by r*x, and y by r*y. |
inverse | |
---|---|
::§Transform → §Transform | |
Dynamic references: | none |
Constructs the inverse of a transform. This is only possible if the linear part of the transform is non-singular. |
mean | |
---|---|
::§Path → §Coords | |
Dynamic references: | none |
Mean point of the path.
Note that this is not the same as the mean of the area that would be painted when filling the path.
| |
::§Path3D → §Coords3D | |
Dynamic references: | none |
Analogous to the the 2d case.
|
pathpoint_mean | |
---|---|
::§Path → §Coords | |
Dynamic references: | none |
Mean of the path points of the path.
| |
::§Path3D → §Coords3D | |
Dynamic references: | none |
Analogous to the the 2d case.
|
maximizer | |
---|---|
::§Path ::§FloatPair → §PathSlider | |
Dynamic references: | none |
Finds the first point on the path where the global maximum in the given direction is attained.
| |
::§Path3D ::§FloatTriple → §PathSlider3D | |
Dynamic references: | none |
Analogous to the the 2d case.
|
pathpoint_maximizer | |
---|---|
::§Path ::§FloatPair → §PathSlider | |
Dynamic references: | none |
Finds the first path point on the path where the global maximum in the given direction is attained.
| |
::§Path3D ::§FloatTriple → §PathSlider3D | |
Dynamic references: | none |
Analogous to the the 2d case.
|
controlling_maximizer | |
---|---|
::§Path ::§FloatPair → §Coords | |
Dynamic references: | none |
Finds the a point among the control points of the path, where the global maximum in the given direction is attained.
| |
::§Path3D ::§FloatTriple → §Coords3D | |
Dynamic references: | none |
Analogous to the the 2d case.
|
intersection | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
::§Path ::§Path → §PathSlider | |||||||||||||
Dynamic references: | none | ||||||||||||
Finds the first point on the first path where it intersects with the second path.
If no intersection is found, the error handler @handler_NoIntersection is called with the two paths as argumets.
Additional information from the computation is stored in the info field of the returned §PathSlider. This structure, in turn, has fields accordning to the following table.
|
@handler_NoIntersection | |
---|---|
Used by: | |
Type: | §Function |
To be called when the intersection between two paths cannot be found.
Shall take the two §Path objects as arguments.
|
approximator | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
::§Path ::§Coords → §PathSlider | ||||||||||||||||
Dynamic references: | none | |||||||||||||||
Finds the first point on the path where the global minimum in distance to the given point is attained.
The algorithm and related tolerances are described in ../algo-tol.html.
| ||||||||||||||||
::§Path ::§Path → §PathSlider | ||||||||||||||||
Dynamic references: | none | |||||||||||||||
Finds a point on the first path where the global minimum in distance to the second path is attained. If there are intersections, the earliest of these is returned
The algorithm and related tolerances are described in ../algo-tol.html.
Additional information from the computation is stored in the info field of the returned §PathSlider. This structure, in turn, has fields accordning to the following table.
| ||||||||||||||||
::§Path3D ::§Coords3D → §PathSlider3D | ||||||||||||||||
Dynamic references: | none | |||||||||||||||
Analogous to the the 2d case.
| ||||||||||||||||
::§Path3D ::§Path3D → §PathSlider | ||||||||||||||||
Dynamic references: | none | |||||||||||||||
Analogous to the the 2d case. However, note that the meaning of intersection is not quite clear in the 3d case, and hence we shall not be precise regarding among which times the earliest is taken if there are several “intersections”.
|
pathpoint_approximator | |
---|---|
::§Path ::§Coords → §PathSlider | |
Dynamic references: | none |
Finds the first path point on the path where the global minimum in distance to the given point is attained.
| |
::§Path3D ::§Coords3D → §PathSlider3D | |
Dynamic references: | none |
Analogous to the the 2d case.
|
rectangle | |
---|---|
::§Coords ::§Coords → §Path | |
Dynamic references: | none |
Constructs a rectangular path with the given points as opposite corners. The path starts at the first of the given points, and if the points are given as bottom-left and upper-right (in that order), the path is oriented counter-clockwise. |
meetpaths | ||||||||
---|---|---|---|---|---|---|---|---|
::§Path ::§Path → §Path | ||||||||
Dynamic references: | none | |||||||
Merge the two paths by merging the end point of the first path with the begin point of the second path. It is not required for the two paths to intersect; the merge operation is defined anyway by replacing the two merged points with one at the mean, taking one interpolation point form each path. Use this to avoid vanishing spline segments when joining two consecutive paths.
Hopefully, the example below expresses the idea more clearly.
| ||||||||
::§Path3D ::§Path3D → §Path3D | ||||||||
Dynamic references: | none | |||||||
Analogous to the the 2d case.
|
svg_path | |
---|---|
d::§String xunit:1 bp::§Lenth yunit:1 bp::§Lenth multi::§Boolean singletons:true::§Boolean → §Path | |
Dynamic references: | none |
Interpret the string d as an svg description of a path. Generally, converting coordinates from the svg model to Shapes is cumbersome, as it basically requires a drawing area in the Shapes world to be defined and related to svg coordinates. However, by disregarding the shift part of the true coordinate transform, only scaling remains to be determined, and for this there is xunit and yunit.
The argument multi is optional. If provided, true means that a §MultiPath will be returned (generally containing several sub paths of type §Path), and false means that there must be exactly one sub path, which will be returned as a §Path.
If singletons is false, paths with zero duration are ignored.
Use this function when you'd rather use a graphical tool to define paths than writing the Shapes code by hand. For instance, paths can be created with Gimp, and exported in svg format.
Note that svg graphics is typically located below the origin, while Shapes (and pdf) programs typically locate graphics above the origin. When determining how to shift the returned path, and this is done using svg information, it must be remembered that the svg y coordinate is increasing downwards.
|
upsample_balance | |
---|---|
::§Path → §Path | |
Dynamic references: | none |
Divide each spline segment in two such that the velocity is continuous at the new path point. This will make the distance to the two interpolation points at the new path point equal, hence the name. It turns out that this happens at spline time 0.5, so the implementation is very cheap.
| |
::§Path3D → §Path3D | |
Dynamic references: | none |
Analogous to the the 2d case.
|
upsample_inflections | |
---|---|
::§Path → §Path | |
Dynamic references: | none |
Add samples at inflection points.
|
upsample_bends | |
---|---|
angle::§Float path::§Path → §Path | |
Dynamic references: | none |
Add samples at inflection points, and so that each segment bends at most angle. Segments that need upsampling (after inflections have been removed) are sampled evenly with respect to direction.
|
upsample_every | |
---|---|
period::§Length path::§Path → §Path | |
Dynamic references: | none |
Add sample points such that each segment is at most period long. Segments that need upsampling are sampled evenly with respect to arc length.
| |
period::§Length path::§Path3D → §Path3D | |
Dynamic references: | none |
Analogous to the the 2d case.
|