DarianFlorianVoda / BioShapes

Bachelor Thesis R Package
0 stars 0 forks source link

[Examples] Description of Liposome #84

Closed discoleo closed 2 years ago

discoleo commented 2 years ago

Examples: Description of Liposome

#### Description of a liposome ####
# d = Dimensions of ArrowHead;
definition_liposome = function(lbl = "Insert text", title = "Liposome",
    lwd=2, d=-0.4, n = c(30, 17)) {
  if(length(lbl) == 1) lbl = rep(lbl, 3);
  # Liposome
  testLiposome = function(lst, col="#48B000", col.line=1){
    testFilledCircle(lst[[1]], line = FALSE, add = TRUE, col=col)
    testFilledCircle(lst[[2]], line = FALSE, add = TRUE, col=col)
    lines.object.base(lst[3], lwd=1, col=col.line)
  }
  lst = liposomes(n, r=0.5, phi=c(0, pi/(2*n[[2]])), d=0.2)
  testLiposome(lst)

  # Title
  if( ! is.null(title)) text(0, -6.5, title);

  # Left arrow
  # TODO: fix d = -d!
  a1 = arrowSimple(x=c(-2.7,-5), y=c(-4.6,-8), d=-d, lwd=lwd);
  text(-5.5, -9, lbl[[1]])

  # Right arrow
  a2 = arrowSimple(x=c(1.4, 5), y=c(-2.4,-7), d=d, lwd=lwd);
  text(5, -8, lbl[[2]])

  # Upper arrow
  a3 = arrowSimple(x=c(0.08,1), y=c(3.5,8), d=d, lwd=lwd);
  text(1, 9, lbl[[3]])
}

plot.base(xlim=c(-10,10), ylim=c(-10,10))
definition_liposome(
    c("Outer lipid layer", "Inner lipid layer", "Lipid bilayer"))
DarianFlorianVoda commented 2 years ago

Added