Various functionality to impose different types of symmetry on knots
force_nodes_mirror_images_LR(x,symobj)
force_nodes_mirror_images_UD(x,symobj)
force_nodes_exactly_horizontal(x,symobj)
force_nodes_exactly_vertical(x,symobj)
force_nodes_on_V_axis(x,xver)
force_nodes_on_H_axis(x,xhor)
force_nodes_rotational(x,symobj)
symmetrize(x,symobj)
tag_notneeded(x, Mver, xver, Mhor, xhor, Mrot,exact_h,exact_v)
make_minsymvec_from_minobj(x,symobj)
minsymvec(vec)
make_minobj_from_minsymvec(minsymvec,symobj)
symmetry_object(x, Mver=NULL, xver=NULL, Mhor=NULL, xhor=NULL,
Mrot=NULL, exact_h=NULL, exact_v=NULL,
mcdonalds=FALSE, celtic=FALSE, reefknot=FALSE,center_crossing=FALSE)
knot(x, overunderobj, symobj, Mver=NULL, xver=NULL, Mhor=NULL,
xhor=NULL, Mrot=NULL, mcdonalds=FALSE, celtic=FALSE,
reefknot=FALSE,center_crossing=FALSE)
Object coerced to class minobj
Matrices specifying vertical (resp. horizontal) symmetry,
with two columns. The rows specify pairs of symmetric nodes about a
vertical (resp. horizontal) axis. Nodes specified by the first column
should be on the left (resp. upper) side; these are fixed. Used by
functions force_nodes_mirror_images_LR()
and
force_nodes_mirror_images_UD()
which move the right (resp. lower)
nodes and their associated handles to the positions required for
exact vertical (resp. horizontal) symmetry
A matrix specifying rotational symmetry. Each row
corresponds to a set of nodes in a rotational relationship. The
number of columns specifies the order of the rotational symmetry.
The first column corresponds to nodes whose position is fixed.
Used by force_nodes_rotational()
, which also moves handles
appropriately
Vector specifying nodes to be on the vertical
(resp. horizontal) axis of symmetry. The nodes are assumed to flow from
left to right. Used by functions force_nodes_on_V_axis()
and
force_nodes_on_H_axis()
respectively, which also move the
handles
Vector specifying nodes to be exactly
horizontal or exactly vertical. A node is exactly horizontal
(resp. vertical) if the y (resp. x) coordinate of the node is the same as the
y (resp. x) coordinate of the handle. Note that the position of an exactly
horizontal or vertical node is not restricted, and may be anywhere. Used by
functions force_nodes_exactly_horizontal()
and
force_nodes_exactly_vertical()
An object representing the symmetry of the knot, usually
created by function symmetry_object()
For vertical symmetry, argument mcdonalds
is
Boolean, defaulting to FALSE
, with TRUE
meaning that
the symmetric pairs of strands approach the vertical line of
symmetry in the same sense (either both moving inward, or both
moving outward). It is hard to explain (and named for the gesture
one makes when tracing the top two strands a knot with this type of
symmetry). The only common knot that needs this is 7_2
Like mcdonalds
but for horizontal symmetry
Like mcdonalds
but for the reefknot
Implements a peculiar type of rotational
symmetry in which the strands pass through the geometrical center of
the knot projection. The only common knot needing this is
9_29
A “minimal symmetric vector”. This is a
numeric vector containing just the independent degrees of freedom of
a knot, after symmetry constraints have been imposed. The idea is
that one may optimize a minsymvec
object using nlm()
,
and then reconstruct a knot using
make_minobj_from_minsymvec()
together with a symmetry object
A vector, given to function minsymvec()
A matrix specifying the overs and the unders; a two-column matrix with rows corresponding to pairs of strands intersecting. The first element of a row identifies the overstrand and the second element specifies the understrand
Robin K.S. Hankin
Function symmetry_object()
creates a symmetry object from
Mver
et seq, but if given a knot
object, returns the
embedded symmetry object.
There are seven types of symmetry that may be imposed on a knot.
These are imposed by the following seven force_nodes_foo()
functions:
Functions force_nodes_mirror_images_LR()
and
force_nodes_mirror_images_UD()
symmetrize a knot about a vertical
(resp. horizontal) axis by taking ordered pairs of nodes, specified by
matrix Mver
(resp. Mhor
) and forcing the second node to be
symmetrically placed with respect to the first. It does the same
thing to the handles too.
Functions force_nodes_exactly_horizontal()
and
force_nodes_exactly_vertical()
force nodes to be exactly
horizontal (resp. vertical) by restricting the
position of their handles. Nodes so forced do not
need to be on an axis of symmetry; they can be anywhere
Functions force_nodes_on_V_axis()
and
force_nodes_on_H_axis()
force nodes specified by xver
(resp. xhor
) to be on the vertical (resp. horizontal)
axis, and to have appropriately placed handles
Function force_nodes_rotational()
imposes the
rotational symmetry specified by Mrot
Function symmetrize()
imposes the seven kinds of symmetry by
calling each of the force_nodes_foo()
functions in turn.
Function tag_notneeded()
is an internal function, not really
intended for the end-user. It takes a minobj
object and marks
a maximal set of dependent entries with a ‘not needed’ value.
The values of the entries so marked may be determined by a combination
of the imposed symmetry relations and the unmarked values. The
unmarked entries constitute a minsymvec
object (see above).
These are the real degrees of freedom in the symmetrical knot.
Only these unmarked values are modified by the optimization routines
in knotoptim()
# each row of M = a pair of symmetrical nodes; each element of v is a
# node on the vertical axis
M <- matrix(c(6,4,13,11,7,3,2,8,9,1,14,10),byrow=TRUE,ncol=2)
v <- c(5,12) # on vertical axis
sym_7_3 <- symmetry_object(k7_3, M, v)
k <- symmetrize(as.minobj(k7_3), sym_7_3)
knotplot2(k) #nice and symmetric!
## OK now convert to and from a mimimal vector for a symmetrical knot:
mii <- make_minsymvec_from_minobj(k, sym_7_3)
pii <- make_minobj_from_minsymvec(mii,sym_7_3)
knotplot2(pii)
## So 'mii' is a minimal vector for a symmetrical knot, and 'pii' is
## the corresponding minobj object. Note that you can mess about with
## mii, but whatever you do the resulting knot is still symmetric:
mii[2] <- 1000
knotplot2(make_minobj_from_minsymvec(mii,sym_7_3)) # still symmetric.
## and, in particular, you can optimize the badness, using nlm():
if (FALSE) {
fun <- function(m){badness(make_minobj_from_minsymvec(m,sym_7_3))}
o <- nlm(fun,mii,iterlim=4,print.level=2)
knotplot2(make_minobj_from_minsymvec(o$estimate,sym_7_3))
}
Run the code above in your browser using DataLab