geometry_warp: Warp a path or polygon with adaptive resampling

Description Usage Arguments Examples

Description

This recursively split each line segment into pieces until the transformed point is less that tolerance away from the transformed line segment.

Usage

1
geometry_warp(geom, fun = c("polar", "identity"), tolerance = NULL)

Arguments

geom

A geometry data frame.

fun

A warping function to use. Currently these are hard coded because they much be implemented in C++ for performance reasons.

tolerance

Approximation errors below this threshold will be ignored. If NULL, attempts to guess a reasonable value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
spiral <- data.frame(
  x = seq(0, 6 * pi, length = 10),
  y = seq(0, 1, length = 10)
)
path <- render_path(spiral, ~x, ~y)
path %>% plot() %>% points()

path %>% geometry_warp("polar") %>% plot()
path %>% geometry_warp("polar", tolerance = 0.1) %>% plot() %>% points()

# Crazy example
expand.grid(x = seq(0, pi, length = 4), y = 0:3) %>%
  render_tile(~x, ~y, halign = 0, valign = 0) %>%
  geometry_pointificate() %>%
  geometry_rotate(15) %>%
  geometry_warp("polar") %>%
  plot()

rstudio/gggeom documentation built on May 28, 2019, 4:35 a.m.