View source: R/conformal_grid.R
conformal_grid | R Documentation |
Given a polygon, find the orthogonal grid from a square projected into the polygon.
conformal_grid(x, ubreaks = 7, vbreaks = 7, n = 100)
x |
a |
ubreaks, vbreaks |
Either an integer value or numeric vector for the location of the grid lines. If an integer value is given, then the dimension will have equidistant grid lines. Else, specify specific values in the u and/or v space between -1, and 1. |
n |
number of data points to use on each margin of the grid. |
Given a orthogonal grid in (u, v) space, conformal_grid
finds and
allows one to plot the mapped grid into the polygon in (x, y) space. The (u,
v) space is a square with vertices at (-1, -1), (1, -1), (1, 1), and (-1, 1).
a sccm_cg
object. A list with two elements, the mapping
is the result of a call to p2p
, and plotting_data
, a
data.frame
which would be easy to use to if you want to plot the
result yourself instead of using the plot.sccm_cg
method.
# Build a star
star <-
rbind(polar2cartesian(1.0, seq(0, 1.6, by = 0.4) * pi),
polar2cartesian(0.5, seq(0.2, 1.8, by = 0.4) * pi))
star <- star[rep(1:5, each = 2) + rep(c(0, 5), times = 5), ]
# generate, and plot, the grid, that would be orthogonal in the (u,v) space, in
# the (x,y) space of the star.
plot(conformal_grid(polygon(star), 15, 11))
# rotate the star
plot(conformal_grid(rotate(polygon(star), times = 3), 15, 11))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.