knotR (version 1.0-2)

symmetrize: Symmetry and knots

Description

Various functionality to impose different types of symmetry on knots

Usage

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)

Value

These functions return a symmetric knot in minobj form.

Arguments

x

Object coerced to class minobj

Mver,Mhor

Matrices specifying vertical (horizontal) symmetry, with two columns. The rows specify pairs of symmetric nodes about a vertical (horizontal) axis. Nodes specified by the first column should be on the left (upper) side

Mrot

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

xver,xhor

Vector specifying nodes to be on the vertical (horizontal) axis of symmetry. The nodes are assumed to flow from left to right

exact_h,exact_v

Vector specifying nodes to be exactly horizontal or exactly vertical. A node is exactly horizontal (vertical) if the y(x) coordinate of the node is the same as the y(x) coordinate of the handle. Note that the position of an exactly horizontal node is not restricted, and may be anywhere

symobj

An object representing the symmetry of the knot, usually created by function symmetry_object()

mcdonalds

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

celtic

Like mcdonalds but for horizontal symmetry

reefknot

Like mcdonalds but for the reefknot

center_crossing

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

minsymvec

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

vec

A vector, given to function minsymvec()

overunderobj

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

Author

Robin K.S. Hankin

Details

  • Function symmetry_object() creates a symmetry object from Mver et seq, but if given a knot object, returns the embedded symmetry object.

  • Functions force_nodes_mirror_images_LR() and force_nodes_mirror_images_UD() symmetrize a knot about a vertical (horizontal) axis by taking ordered pairs of nodes, specified by matrix Mver (Mhor) and forcing the second node to be symmetrically placed with respect to the first

  • Functions force_nodes_exactly_horizontal() and force_nodes_exactly_vertical() force nodes to be exactly horizontal or exactly vertical respectively. Nodes so forced do not need to be on an axis of symmetry; they can be anywhere

  • Function symmetrize_ROT() symmetrizes a knot around a point of symmetry, producing a rotationally symmetric knot

Examples

Run this code

# 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 DataCamp Workspace