tarrows: Move Arrows

Description Usage Arguments Value Author(s) See Also Examples

View source: R/animatoR-functions-knitr.R

Description

Move arrows from start to end location

Usage

1
2
tarrows(x0, y0, x1, y1, x2 = x0, y2 = y0, x3 = x1, y3 = y1, t, when,
  p = 1, length = 0.125, ...)

Arguments

x0, x1

numeric vectors, start arrow defining x coordinates.

y0, y1

numeric vector, start arrow defining y coordinates.

x2, x3

numeric vector, end arrow defining x coordinates.

y2, y3

numeric vector, end arrow defining y coordinates.

t

numeric, homotopy parameter, limited between 0 and 1. This parameter can be considered as fraction of animation duration time.

when

numeric vector. This parameter controls the times of: entrance, exit, start of movement and, end of movement.

p

numeric, homotopy power parameter. Defaults to 1.

length

length of the edges of the arrow head (in inches).

...

additional arguments passed to arrows.

Value

List with numerical components x and y with current position

Author(s)

Andrej Blejec andrej.blejec@nib.si

See Also

arrows, darrows for drawing arrows and tsegments for moving segments.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
x0 <- c(0,4,7)
y0 <- c(0,7,0)
x1 <- c(4,0,7)
y1 <- c(2,7,5)
x2 <- x0+1
y2 <- y0+2
x3 <- x1+1
y3 <- y1+2
newplot()
arrows(x0,y0,x2,y2,lty=2)
arrows(x1,y1,x3,y3,lty=2)
arrows(x0,y0,x1,y1,col=2)
pos <- tarrows(x0,y0,x1,y1,x2,y2,x3,y3,0.75,lwd=3)
arrows(x2,y2,x3,y3,col=4)
pos
points(pos$start)
points(pos$end)
d <- 0.2
points(x0-d,y0+d,pch="0")
points(x1+d,y1+d,pch="1")
points(x2-d,y2+d,pch="2")
points(x3+d,y3+d,pch="3")

ablejec/animatoR documentation built on Feb. 21, 2020, 10:09 p.m.