p2p | R Documentation |
Map the data within a polygon to another polygon via Schwarz-Christoffel conformal mapping.
p2p(
.data,
pg1 = sccm::convex_hull(.data),
pg2 = sccm::polygon(x = c(-1, 1, 1, -1), y = c(-1, -1, 1, 1)),
...
)
.data |
the data set to map |
pg1 |
the polygon containing the |
pg2 |
the polygon to map |
... |
additional arguments passed to |
a sccm_p2d
object, a list with the following elements:
a n by 2 matrix with the (x, y) coordinates of the mapped data in the target polygon.
a n by 2 matrix with the (x, y) coordinates of the mapped data in the unit disk.
The original data
The polygon the .data was contained in
The polygon the .data was mapped into
the Schwarz-Christoffel mapping between the unit disk and polygon1.
the Schwarz-Christoffel mapping between the unit disk and polygon2.
scmap
d2p
p2d
set.seed(42)
n <- 2500L
dat <- data.frame(x = 1 + runif(n))
dat$y <- log(dat$x) + rnorm(n, sd = 0.2)
ch <- sccm::convex_hull(dat)
plot(ch)
trans <- sccm::p2p(dat)
plot(trans)
star <-
rbind(sccm::polar2cartesian(r = 1.0, theta = seq(0, 1.6, by = 0.4) * pi),
sccm::polar2cartesian(r = 0.6, theta = seq(0.2, 1.8, by = 0.4) * pi))
star <- star[rep(1:5, each = 2) + rep(c(0, 5), times = 5), ]
trans <- sccm::p2p(dat, pg2 = sccm::polygon(star))
plot(trans)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.