zykloid {cycloids}R Documentation

Core function for calculating coordinate representations of hypocycloids, epicyloids, hypotrochoids, and epitrochoids (altogether called 'cycloids' here)

Description

This is the package's core function for calculating cycloids. These are represented by a set of two-dimensional point coordinates. Although this function provides the essential mathematics, you may want to use the wrappers zykloid.scaleA, zykloid.scaleAa, and zykloid.scaleP due to their convenient scaling and positioning options.

Usage

zykloid(A, a, lambda, hypo = TRUE, steps = 360, start = pi/2)

Arguments

A

The Radius of the fixed circle cfixcfix. Must be an integer Number > 0.

a

The radius of the moving circle cmovcmov. Must be an integer Number > 0. Together with AA, aa determines the resulting cycloid's shape and number of peaks which can be calculated with npeaks.

lambda

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

hypo

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

steps

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

start

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

Details

Geometrically, cycloids in the sense of this package are generated as follows (Figure 1, 2): Imagine a circle cfixcfix, with radius AA, which is fixed on a plane. Another circle, cmovcmov, with radius aa, is rolling along cfixcfix's circumference at the outside of cfixcfix. The figure created by the trace of a point on cmovcmov's circumference is called an epicycloid (Figure 1A). If cmovcmov is rolling not at the outside but at the inside of cfixcfix, the trace of a point on cmovcmov's circumference is called an hypocycloid (Figure 2A).
If in both cases the tracepoint is not located on cmovcmov's circumference but at a fixed distance from its midpoint either in- or outside cmovcmov, the resulting figure is an epitrochoid (Figure 1B, C) or a hypotrochoid (Figure 2B, C), respectively.
With the arguments of zykloid as defined above, the centre of cfixcfix in the origin, and phiphi being the counterclockwise angle of cmovcmov's midpoint against the start position with cfixcfix' centre as the pivot, the cartesian coordinates of a point on the cycloid are calculated as follows:

x=(A+a)cos(phi+start)lambdaacos((A+a)/aphi+start)x = (A + a) * cos(phi + start) - lambda * a * cos((A + a)/a * phi + start)
y=(A+a)sin(phi+start)lambdaasin((A+a)/aphi+start)y = (A + a) * sin(phi + start) - lambda * a * sin((A + a)/a * phi + start)

Figure1.png Figure2.png

Value

A dataframe with the columns xx and yy. 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.

Author(s)

Peter Biber

References

Bronstein IN, Semendjaev KA, Musiol G, Muehlig H (2001): Taschenbuch der Mathematik, 5th Edition, Verlag Harri Deutsch, 1186 p. (103 - 105)

http://en.wikipedia.org/wiki/Epicycloid

http://en.wikipedia.org/wiki/Hypocycloid

http://en.wikipedia.org/wiki/Epitrochoid

http://en.wikipedia.org/wiki/Hypotrochoid

See Also

zykloid.scaleA, zykloid.scaleAa, zykloid.scaleP

Examples


# Very simple example
cycl <- zykloid(A = 17, a = 9, lambda = 0.9, hypo = TRUE)
plot(y ~ x, data = cycl, asp = 1, type = "l")


# More complex: Looks like a passion flower
op <- par(mar = c(0,0,0,0), bg = "black")
plot.new()
plot.window(asp = 1, xlim = c(-23, 23), ylim = c(-23, 23))
ll   <- seq(2, 0, -0.2)
ccol <- rep(c("lightblue", "lightgreen", "yellow", "yellow",
              "yellow"), 2)
for (i in c(1:length(ll))) {
     z <- zykloid(A = 15, a = 7, lambda = ll[i], hypo = TRUE)
     lines(y ~ x, data = z, col = ccol[i])
} # for i
par(op)


# Dense hypotrochoids
op <- par(mar = c(0,0,0,0), bg = "black")
plot.new()
plot.window(asp = 1, xlim = c(-1.5, 1.5), ylim = c(-1.5, 1.5))
m <- zykloid(A = 90, a = 89, lambda = 0.01)
lines(y ~ x, data = m, col = "grey")
m <- zykloid(A = 90, a = 89, lambda = 0.02)
lines(y ~ x, data = m, col = "red")
m <- zykloid(A = 90, a = 89, lambda = 0.015)
lines(y ~ x, data = m, col = "blue")
par(op)


# Fragile star
op <- par(mar = c(0,0,0,0), bg = "black")
plot.new()
plot.window(asp = 1, xlim = c(-14, 14), ylim = c(-14, 14))
l.max <- 1.6
l.min <- 0.1
ll <- seq(l.max, l.min, by = -1 * (l.max - l.min)/30)
n  <- length(ll)
ccol <- rainbow(n, start = 2/3, end = 1)
for (i in c(1:n)) {
    m <- zykloid(A = 9, a = 8, lambda = ll[i])
    lines(y ~ x, data = m, type = "l", col = ccol[i])
}  # for i
par(op)



[Package cycloids version 1.0.2 Index]