# NOT RUN {
########################################
#2d static examples
########################################
#centered hexagon
ps <- eq.arot2 (6, start = pi / 6) %*|% c (0, 1)
polyplot (ps, transpose=TRUE)
#four hexagons, different sizes
vm <- ascl2 (seq (1.3, 0.7,, 4) ) %*[% ps
polyplot (vm, transpose=TRUE)
#scaled, translated, then rotated (cartesian)
vm.c <-
    eq.arot2 (8) %{*}%
    (   atrl2 (,3.75) %*%
        ascl2 (seq (1.3, 0.7,, 4) )
    ) %*[%
    ps
polyplot (vm.c, transpose=TRUE)
#scaled, translated, then rotated (standard, but rev)
vm.s <-
    eq.brot2 (8) %{*}%
    atrl2 (,3.75) %*%
    ascl2 (seq (1.3, 0.7,, 4) ) %*[%
    ps
polyplot (vm.s, transpose=TRUE)
########################################
#3d dynamic example
########################################
sim3d <- function (N=200, DELAY=0)
{   start <- runif (3, -4, 0)
    end <- runif (3, 0, 4)
    xpos <- seq (start [1], end [1],, N)
    ypos <- seq (start [2], end [2],, N)
    zpos <- seq (start [3], end [3],, N)
    nrots <- runif (3, 1, 4)
    start <- runif (3, 0, 2 * pi)
    end <- start + 2 * pi * nrots
    xtheta <- seq (start [1], end [1],, N)
    ytheta <- seq (start [2], end [2],, N)
    ztheta <- seq (start [3], end [3],, N)
	
    for (k in 1:N)
    {   ps <-
            arot3z (ztheta [k]) %*%
            arot3y (ytheta [k]) %*%
            arot3x (xtheta [k]) %*%
            atrl3 (xpos [k], ypos [k], zpos [k]) %*[%
            t (cubps)
        cubplot (ps, transpose=TRUE)
        if (DELAY > 0)
            Sys.sleep (DELAY)
    }
}
if (interactive () )
    sim3d (200, 0)
# }
Run the code above in your browser using DataLab