simple_shapes: Some different geometries to play with

simple_shapesR Documentation

Some different geometries to play with

Description

These functions are provided to allow you to play with somee simple shapes as you explore transformr and are also used in the examples for the different tween functions. All geometries can be returned as either a standard data.frame with x, y, and id column, or as an sf geometry of the appropriate type.

Usage

poly_circle(st = FALSE, detail = 360)

poly_circles(st = FALSE, n = 3, r = 0.25, detail = 360)

poly_star(st = FALSE, n = 5, r1 = 0.5)

poly_star_hole(st = FALSE, n = 5, r1 = 0.5)

path_spiral(st = FALSE, windings = 5)

path_waves(st = FALSE, w1 = 7, w2 = 11)

point_random(st = FALSE, n = 10)

point_grid(st = FALSE, dim = 5)

Arguments

st

Logical. Should the geometry be returned as an sf feature?

detail

The number of points defining the shape

n

For poly_circles the number of circles, for poly_star and poly_star_hole the number of 'arms', and for point_random the number of points

r, r1

The radius of the geometry. r gives the radius of the circles in poly_circles and r1 gives the inner radius for poly_star/poly_star_hole, thus determining how pointy it is

windings

The number of revolutions in the spiral

w1, w2

The frequency for the two sine waves

dim

the number of rows and columns in the grid

Value

Either a data.frame or an sf feature depending on the value of st

Examples

# Create a 7-pointed star
poly_star(n = 7)


transformr documentation built on Aug. 18, 2022, 5:05 p.m.