inst/8_3_90deg_crossing_worker.R

library(knotR)
filename <- "8_3_90deg_crossing.svg"
a <- reader(filename)
#knotplot2(a,node=TRUE)
#stop()
Mver <- matrix(c(
     10,24,
     23,11,
     9,1,
     8,2,
     12,22,
     21,13,
     14,20,
     15,19,
     7,3,
     16,18,
     6,4
),ncol=2,byrow=TRUE)

sym83 <- symmetry_object(a,Mver=Mver,xver=c(5,17))
a <- symmetrize(a,sym83)
#knotplot2(a,lwd=1,text=TRUE,circ=FALSE,rainbow=TRUE)


ou83 <- matrix(c(
     11,24,
     23,12,
     13,22,
     21,14,
     3,20,
     18,4,
     7,17,
     15,8
),ncol=2,byrow=TRUE)

#knotplot(a,ou83)

w <- c(pot = 1,
      ang = 100,
      ben = 1,
      len = 1,
      mid = 1,
      clo = 1,
      swi = 1,
      con = 1,
      ncn = 1
      )

jj <-
  knotoptim(filename, weights=w,
            symobj = sym83,
            ou   = ou83,
            prob = 0,
            iterlim=1000,print.level=2,hessian=FALSE
#                control=list(trace=100,maxit=1000), # these arguments for optim()
#                useNLM=FALSE
)


write_svg(jj, filename,safe=FALSE)
dput(jj,file=sub('.svg','.S',filename))
RobinHankin/knotR documentation built on Feb. 18, 2024, 12:41 a.m.