conformal_grid: Conformal Grid

View source: R/conformal_grid.R

conformal_gridR Documentation

Conformal Grid

Description

Given a polygon, find the orthogonal grid from a square projected into the polygon.

Usage

conformal_grid(x, ubreaks = 7, vbreaks = 7, n = 100)

Arguments

x

a sccm_pg or sccm_ch object

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.

Details

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).

Value

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.

Examples

# 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))

dewittpe/sccm documentation built on Feb. 2, 2024, 5:25 p.m.