DarianFlorianVoda / BioShapes

Bachelor Thesis R Package
0 stars 0 forks source link

[Tests] Simple ArrowHead Test 2: Improved comments #55

Closed discoleo closed 2 years ago

discoleo commented 2 years ago

Simple ArrowHead: Test 2

### Test 2
# - narrow ArrowHead;
x = c(0, 6); y = c(1, 6) + 1;
d=-1.5; d.head = c(-0.5, 0.5);
plot.base()
a1 = arrowSimple(x, y, d=d, d.head=d.head, lwd=2);
a2 = arrowSimple(c(x[1], 5), c(y[1], y[1]), d=d, d.head=d.head, lwd=2);
a3 = arrowSimple(c(x[1], x[1]), c(y[1], 5), d=d, d.head=d.head, lwd=2);
# Head
h1 = a1$Head[[1]]
h2 = a2$Head[[1]]
h3 = a3$Head[[1]]
# - visual aids:
lines(h1$x[c(1,3)], h1$y[c(1,3)], col="green")
lines(h2$x[c(1,3)], h2$y[c(1,3)], col="green")
lines(h3$x[c(1,3)], h3$y[c(1,3)], col="green")
# Total length = (d^2 + dV[1]^2) + (d^2 + dV[2]^2)
stopifnot(round(Dsquare(h1, h1$x[2], h1$y[2]) - 2*d^2 - sum(d.head^2), 8) == 0)
stopifnot(round(Dsquare(h2, h2$x[2], h2$y[2]) - 2*d^2 - sum(d.head^2), 8) == 0)
stopifnot(round(Dsquare(h3, h3$x[2], h3$y[2]) - 2*d^2 - sum(d.head^2), 8) == 0)
DarianFlorianVoda commented 2 years ago

Added.