# NOT RUN {
########################################
#2d static examples
########################################
#centered hexagon
ps <- c (0, 1) %|*% eq.brot2 (6, start = pi / 6)
polyplot (ps)
#four hexagons, different sizes
vm <- ps %]*% bscl2 (seq (1.3, 0.7,, 4) )
polyplot (vm)
#scaled, translated, then rotated (cartesian)
vm.c <- ps %]*% (
    bscl2 (seq (1.3, 0.7,, 4) ) %*%
    btrl2 (,3.75) %{*}%
    eq.brot2 (8) )
polyplot (vm.c)
#scaled, translated, then rotated (standard, but rev)
vm.s <- ps %]*% (
    bscl2 (seq (1.2, 0.6,, 5) ) %*%
    btrl2 (,4) %*%
    eq.arot2 (10) )
polyplot (vm.s)
########################################
#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 <- cubps %]*% (
            btrl3 (xpos [k], ypos [k], zpos [k]) %*%
            brot3x (xtheta [k]) %*%
            brot3y (ytheta [k]) %*%
            brot3z (ztheta [k]) )
        cubplot (ps)
        if (DELAY > 0)
            Sys.sleep (DELAY)
    }
}
if (interactive () )
    sim3d (200, 0)
# }
Run the code above in your browser using DataLab