rotate: Rotate Fractals

Description Usage Arguments Value Examples

View source: R/rotate.R

Description

Rotate a fractal by multiples of 90 degrees.

Usage

1
2
3
4
5
6
7
rotate(fractal, n)

## S3 method for class 'matrix'
rotate(fractal, n)

## S3 method for class 'dragon_curve'
rotate(fractal, n)

Arguments

fractal

The fractal to be rotated.

n

An integer specifying the number and direction of turns. A positive value turns counterclockwise and a negative value turns clockwise.

Value

The rotated fractal.

Examples

1
2
3
4
5
6
d <- dragon_curve(10)
d_l <- rotate(d, 1)  # rotate once to the left
d_r <- rotate(d, -2)  # rotate twice to the right
plot(d)
plot(d_l)
plot(d_r)

BastiHz/fractalplotr documentation built on Sept. 9, 2021, 4:46 a.m.