Learn R Programming

xkcd (version 0.0.3)

poinstcircunference: Calculates a handwritten circunference

Description

This function estimate points to draw a handwritten circunference.

Usage

pointscircunference(x=0, y=0, diameter=1, ratioxy=1,
                    npoints= 16, alpha= runif(1, 0, pi/2))

Arguments

x
A numeric value. Coordinate x of the center of the circunference.
y
A numeric value. Coordinate y of the center of the circunference.
diameter
A numeric value. Diameter fo the circunference.
ratioxy
A numeric value. Ratio x to y.
npoints
Number of points (including the limits).
alpha
Numeric. Angle to begin to calculate the circunferece.

Value

  • A data frame with the points of the circunference.

Details

It calculates a circunference in a XKCD style.

By default, the data are smoothed using a Bezier curve. It gives 60 points.

Examples

Run this code
plot(pointscircunference(x=0, y=0), ylim=c(-1,1), xlim=c(-1,1))
plot(pointscircunference(x=0, y=0), ylim=c(-1,1), xlim=c(-2,2))
plot(pointscircunference(x=0, y=0, ratioxy=2),  ylim=c(-1,1), xlim=c(-2,2))

Run the code above in your browser using DataLab