Skip to contents

This function generates the coordinates of hexagons after passing hexagonal centroids.

Usage

gen_hex_coord(centroids_df, a1)

Arguments

centroids_df

The dataset with all hexagonal bin IDs and centroid coordinates.

a1

The width of the hexagon.

Value

A tibble contains polygon id, x and y coordinates (hex_poly_id, x, and y respectively) of hexagons.

Examples

width <- s_curve_obj$s_curve_umap_hb_obj$a1
all_centroids_df <- s_curve_obj$s_curve_umap_hb_obj$centroids
gen_hex_coord(centroids_df = all_centroids_df, a1 = width)
#> # A tibble: 120 × 3
#>    hex_poly_id       x         y
#>          <int>   <dbl>     <dbl>
#>  1           1 -0.1     0.0949  
#>  2           1 -0.263   0.000514
#>  3           1 -0.263  -0.188   
#>  4           1 -0.1    -0.283   
#>  5           1  0.0634 -0.188   
#>  6           1  0.0634  0.000514
#>  7           2  0.227   0.0949  
#>  8           2  0.0634  0.000514
#>  9           2  0.0634 -0.188   
#> 10           2  0.227  -0.283   
#> # ℹ 110 more rows