caleidoscope: Caleidoscopic effect on a matrix

Description Usage Arguments Details Value Examples

View source: R/caleidoscope.R

Description

Flip a matrix vertically and horizontally before recombining into a new large matrix

Usage

1
caleidoscope(m, odd = TRUE)

Arguments

m

a matrix

odd

logical; should the resulting matrix have odd dimensions?

Details

Three copies of m will be made. One flipped horizontally, one flipped vertically, and one flipped both horizontally and vertically. Then they are recombined with the original matrix in the upper right corner, and the flipped copies in the upper left, lower righ and lower left corners, respectively.

Value

A matrix of either or 2× - 1 the number of rows and columns of the input matrix.

Examples

1
2
3
4
5
caleidoscope(matrix(1:4, 2), odd=FALSE)

image(caleidoscope(1:9 %o% 1:9))

image(caleidoscope(matrix(runif(180*200)^2, 180)), col=rainbow(256, start=0.58))

AkselA/R-ymse documentation built on March 21, 2020, 9:52 a.m.