spirographR: Make a sprirograph-like design

View source: R/spirographR.R

spirographRR Documentation

Make a sprirograph-like design

Description

spirographR will produce sprirograph-like design as either a hypotrochoid or an epitrochoid (depending on whether radius A or B is larger).

Usage

spirographR(
  x = 0,
  y = 0,
  a.rad = 1,
  b.rad = -4,
  bc = -2,
  rev = 4,
  n.per.rev = 360
)

Arguments

x, y

Center coordinates of stationary circle 'a'

a.rad

Radius of stationary circle 'a'

b.rad

Radius of circle 'b' travelling around stationary circle 'a'

bc

Distance from the center of 'b' to a point 'c' which will turn with b as if attached to a stick.

rev

Number of revolutions that 'b' should travel around 'a'

n.per.rev

Number of radial increments to be calculated per revolution

Details

A positive value for 'b' will result in a epitrochoid, while a negative value will result in a hypotrochoid.

Examples

op <- par(mar=c(0,0,0,0), bg=1)
plot(spirographR(), t="l", col=6, lwd=3)
plot(spirographR(a.rad=1, b.rad=3.5, rev=7), t="l", col=7, lwd=3)
plot(spirographR(a.rad=4.1, b.rad=-6, rev=100, bc=2.3), t="l", col=5, lwd=1)
par(op)


marchtaylor/sinkr documentation built on July 4, 2022, 5:48 p.m.