Learn R Programming

matRiks (version 0.1.3)

rotate: Rotation rule (Method)

Description

Apply a rotation of a fixed angle to a figure

Usage

rotate(fig, n, rule, ...)

# S3 method for figure rotate(fig, n = 4, rule = "rotation", ...)

Value

A figure of class figure with different rotation coordinates

A figure of class figure with different rotation coordinates

Arguments

fig

The figure on which the rule is applied

n

integer, defines the angle of the rotation. Default is 4, which corresponds to a rotation of \({4}\alpha\)

rule

character, defines the rotation rule. Default is counterclockwise. If the rule arguments contain the string "inv" forces a clockwise rotation. Each corresponds to an \(\alpha=\frac{1}{k}\pi\). Default \(k\) is 4. To change the value of \(k\) is sufficient to add a number from 1 to 9 in the argument.

...

Other arguments

Methods (by class)

  • rotate(figure): Rotate a figure

    Apply a rotation of a fixed angle to a figure

Examples

Run this code
# default luck
draw(luck())

# apply the default rotation on the default luck
draw(rotate(luck()))

# force clockwise rotation
draw(rotate(luck(), rule = "inv"))
# default luck
draw(luck())

# apply the default rotation on the default luck
draw(rotate(luck()))

# force clockwise rotation
draw(rotate(luck(), rule = "inv"))

Run the code above in your browser using DataLab