Description Usage Arguments Value Examples
View source: R/read_polygon_edges.R
Special reader function for polygon edge output of voro++.
1 | read_polygon_edges(x, rescale = TRUE)
|
x |
character vector with raw, linewise output of voro++ as produced with
tessellate when |
rescale |
Should the output of tessellate be back-rescaled according to its
|
data.table with columns for the coordinates x, y and z of the starting and end point of each polygon edge
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | random_unique_points <- unique(data.table::data.table(
id = NA,
x = runif(10, 0, 100000),
y = runif(10, 0, 100000),
z = runif(10, 0, 100)
))
random_unique_points$id <- seq_len(nrow(random_unique_points))
voro_output <- tessellate(random_unique_points, unit_scaling = c(0.001, 0.001, 1))
polygon_points <- read_polygon_edges(voro_output)
cut_surfaces <- cut_polygons(polygon_points, c(20, 40, 60))
cut_surfaces_sf <- cut_polygons_to_sf(cut_surfaces, crs = 25832)
polygons_z_20 <- sf::st_geometry(cut_surfaces_sf[cut_surfaces_sf$z == 20, ])
plot(polygons_z_20, col = sf::sf.colors(10, categorical = TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.