These functions can be used to describe a MetaPost path, consisting of two or more knots, with various constraints on how the path behaves between the knots.
knot(x, y, units = getOption("metapost.units"),
dir = NA, dir.left = dir, dir.right = dir,
cp.left.x = NA, cp.right.x = NA, cp.left.y = NA, cp.right.y = NA,
curl.left = NA, curl.right = NA,
tension.left = NA, tension.right = NA)
cp(x, y, units = getOption("metapost.units"))
curl(x)
cycle()
dir(x, y = NULL)
tension(x)
Numeric value: a location (for knot
and cp
), or
an angle (for dir
, if y
is NULL
), or a
vector component (for dir
), or
a curl or tension value.
Or a grid unit (for knot
and cp
).
Numeric value: a location (for knot
and cp
), or a
vector component (for dir
).
Or a grid unit (for knot
and cp
).
The grid coordinate system to use for locations (if locations are only given as numeric values).
A numeric angle.
A numeric location.
A numeric curl value (must be at least 0).
A numeric tension value (must be at least 3/4). A negative values indicates a lower bound.
The individual functions generate knots and connectors, but when
combined together, they produce a MetaPost path ("mppath"
) object.
A MetaPost path is constructed using calls to knot
and
combining the results using the +
operator (see the examples
below).
Constraints for a knot can be specified within the call to knot
or by combining connectors (cp
, dir
, etc)
with a knot using +
.
Knots can also be combined using -
(a straight line rather than
a curve), %+%
(no inflection), and %-%
(straight
line with smooth connection) operators.
Hobby, J. D. and the MetaPost development team (2018). METAPOST a user's manual. https://www.tug.org/docs/metapost/mpman.pdf
# NOT RUN {
knot(0, 0, dir.right=0)
knot(0, 0, dir.right=0) + knot(1, 1)
knot(0, 0) + dir(0) + knot(1, 1)
# }
Run the code above in your browser using DataLab