Learn R Programming

cycloids (version 1.0.2)

zykloid.scaleAa: Wrapper for zykloid which scales a cycloid by its outer radius and allows free positioning

Description

While zykloid provides the basic functionality for calculating cycloids, this functions allows to re-size a cycloid by freely setting the radius of its circumcircle. In addition, the cycloid can be re-positioned by locating the fixed circle's midpoint. This function behaves similarly as zykloid.scaleP. See details. Figures 1 and 2 and zykloid describe the geometrical principles of cycloids.

Usage

zykloid.scaleAa(A, a, lambda, hypo = TRUE, Cx = 0, Cy = 0,
                RadiusAa = 1, steps = 360, start = pi/2)

Value

A dataframe with the columns \(x\) and \(y\). Each row represents a tracepoint position. The positions are ordered along the trace with the last and the first point being identical in order to warrant a closed figure when plotting the data.

Arguments

A

The Radius of the fixed circle before re-sizing. Must be an integer Number > 0. Together with \(a\) (see below), \(A\) is only determining the cycloid's shape and number of peaks (see npeaks), while its actual size is defined by the argument \(RadiusAa\) (see below).

a

The radius of the moving circle before re-sizing. Must be an integer Number > 0. Together with \(A\), \(a\) only determines the cycloid's shape and number of peaks (see npeaks), while its actual size is defined via the argument \(RadiusAa\) (see below).

lambda

The distance of the tracepoint from the moving circle's (\(cmov\)) centre in relative units of its radius \(a\). \(lambda = 1\) means that the tracepoint is located on \(cmov\)'s circumference. For \(lambda < 1\), the tracepoint is on \(cmov\)'s area, e.g. if \(lambda = 0.5\), it is halfway between \(cmov\)'s centre and its circumference. If \(lambda > 1\) the tracepoint is outside \(cmov\)'s area, you might imagine it being attached to a rod which is attached to \(cmov\) and crosses its centre. E.g. \(lambda = 2\) would mean that the tracepoint's distance from cmov's centre equals \(2*a\). \(lambda = 0\) produces a circle because the tracepoint is identical with \(cmov\)'s centre.

hypo

logical. If TRUE, the resulting figure is a hypocycloid (\(lambda = 1\)) or a hypotrochoid (\(lambda != 1\)), because \(cmov\) is rolling along the inner side of the fixed circle (\(cfix\)). If FALSE, an epicycloid (\(lambda = 1\)) or an epitrochoid \(\lambda != 1\) is generated, as \(cmov\) is rolling at the outside of \(cfix\)'s circumference.

Cx

x-coordinate of the fixed circle's midpoint. Default is 0.

Cy

y-coordinate of the fixed circle's midpoint. Default is 0.

RadiusAa

The actual radius of the cycloids outer circle. Default is 1.

steps

positive integer. The number of steps per circuit of the moving circle (cmov) for which tracepoint positions are calculated. The default, 360, means steps of 1 degree for the movement of cmov. Analogously, steps = 720 would mean steps of 0.5 degrees.

start

Start angle (radians) of the moving circle's (\(cmov\)) centre counterclockwise to the horizontal with the fixed circle's (\(cfix\)) centre as the pivot. The tracepoint will start at a peak.

Author

Peter Biber

Details

This function scales in either case the radius of the whole cycloid's circumcircle. Thus, for hypocycloids and hypotrochoids it will behave the same way as zykloid.scaleP. For epicycloids and epitrochoids their output will be different. zykloid.scaleAa scales the outer edge of the figure, while zykloid.scaleP always scales the circle where the peaks of the figure are located on. In the case of epicycloids and epitrochoids this is at the inside of the figure (see examples).
Figure 1 and 2 show the principle behind cycloid construction:

See Also

zykloid, zykloid.scaleA, zykloid.scaleP

Examples

Run this code

# Same epicycloid scaled to different maximum radii of the figure
cycl1 <- zykloid.scaleAa(A = 21, a = 11, lambda = 1, hypo = FALSE,
                         RadiusAa = 100)
cycl2 <- zykloid.scaleAa(A = 21, a = 11, lambda = 1, hypo = FALSE,
                         RadiusAa =  70)
cycl3 <- zykloid.scaleAa(A = 21, a = 11, lambda = 1, hypo = FALSE,
                         RadiusAa =  40)
plot (y ~ x, data = cycl1, col = "red", asp = 1, type = "l",
      main = "A = 21, a = 11, lambda = 1")
lines(y ~ x, data = cycl2, col = "green")
lines(y ~ x, data = cycl3, col = "blue")
legend("topleft", c("RadiusAa = 100", "RadiusAa =  70", "RadiusAa =  40"),
       lty = rep("solid", 3), col = c("red", "green", "blue"), bty = "n")
       

# Pentagram by constructing a hypocycloid and an epicycloid
# with the same outer radius and scaling this radius exponentially
op <- par(mar = c(0,0,0,0), bg = "black")
plot.new()
plot.window(asp = 1, xlim = c(-40, 40), ylim = c(-40, 40))
n <- 20
ccol <- heat.colors(n)
for(i in c(1:n)) {
    zzz <- zykloid.scaleAa(A = 5, a = 2,
           RadiusAa = 38*exp(-0.05*(i-1)), hypo = FALSE, lambda = 1)
    lines(y ~ x, data = zzz, col = ccol[i])
    zzz <- zykloid.scaleAa(A = 5, a = 2,
           RadiusAa = 38*exp(-0.05*(i-1)), hypo = TRUE,  lambda = 1)
    lines(y ~ x, data = zzz, col = ccol[i])
} # for i
par(op)



# Psychedelic star by modifying lambda while keeping the outer
# radius constant
op <- par(mar = c(0,0,0,0), bg = "black")
plot.new()
plot.window(asp = 1, xlim = c(-5, 5), ylim = c(-5, 5))
llam <- seq(0, 8, 0.2)
ccol <- terrain.colors(length(llam))
for(i in c(1:length(llam))) {
    zzz <- zykloid.scaleAa(A = 5, a = 1, RadiusAa = 4.5,
           hypo = FALSE, lambda = llam[i])
    lines(y ~ x, data = zzz, col = ccol[i])
} # for i
par(op)

Run the code above in your browser using DataLab