Various utilities for knots including reading files and creating objects
controlpoints(x)
inkscape(x)
minobj(x)
knotvec(x)
make_controlpoints_from_ink(a)
make_minobj_from_ink(a)
make_minobj_from_vector(vec)
make_ink_from_minobj(x)
make_inkscape_from_controlpoints(b)
make_minobj_from_knot(k)
make_knotvec_from_minobj(x)
Suitable object for coercion; see details
An inkscape
object: a two column matrix with rows
representing the positions of nodes and control points
A controlpoints object
An object of class knot
A vector of reals
Robin K. S. Hankin
Functions inkscape()
, minobj()
, and knotvec()
are
low-level functions; these are the only places that objects have their
classes assigned directly. These functions are not user-friendly and
require very specific types of object; they perform some checks but
are not really intended for the user. Functions as.foo()
are
much more user-friendly, and are documented at as.Rd
.
Functions make_foo_from_bar()
coerce bar
objects into
foo
objects. Functions that involve symmetry are documented at
symmetry.Rd
.
Objects of class inkscape
are in the form of a two-column
matrix, with rows corresponding to 2D positions. The rows correspond
to the \((x,y)\) coordinates of points as held in the inkscape file.
There is quite a lot of redundancy in an inkscape object:
The first row of an inkscape object is equal to the last row (this follows from the fact that the path is closed).
If \(n=0\) modulo 3, then
a[n+2,]-a[n+1,]==a[n+1,]-a[n]
, corresponding to the fact that
the handles are symmetric in inkscape. This is visualised best by
knotplot2(k4_1,ink=TRUE,seg=TRUE)
Look at functions make_inkscape_from_minobj()
and
make_minobj_from_ink()
to see this from a symbolic
perspective. The vignette also gives some details.
The minobj
class is a ‘MINimal OBJect’; there
is no redundancy. Objects of class minobj
are a list
of two elements: $node
and $handle_A
. Each element has
rows corresponding to 2D positions, the same as inkscape
objects. Element $node
shows the positions of the nodes, and
element $handle_A
shows the positions of (one of) the handles;
the other handle is symmetrically positioned with respect to its node.
Use knotplot2(k4_1,node=TRUE,seg=TRUE)
to see the meaning
of the entries; the nodes are indicated by a square and the handles by
circles.
An object of class controlpoints
is a list of matrices of size
4-by-2. For each matrix, the four rows correspond to the points in
2D Cartesian space needed to specify a Bezier curve; further details
and examples are given in bezier.Rd
.
The knotvec
class is a named vector of independent
reals suitable for use with optimization routines.
None of the functions here deal with symmetry relations. This is
documented at symmetry.Rd
.
knotplot
,symmetrize
,bezier
if (FALSE) {
a <- reader("6_3.svg") # 'a' is an inkscape object.
knotplot(a)
}
Run the code above in your browser using DataCamp Workspace