Skip to contents

This function generates edge information from a given triangular object, including the coordinates of the vertices and the from-to relationships between the vertices.

Usage

gen_edges(tri_object)

Arguments

tri_object

The triangular object from which to generate edge information.

Value

A tibble that contains the edge information, including the from-to relationships and the corresponding x and y coordinates.

Examples

r2 <- diff(range(s_curve_noise_umap$UMAP2))/diff(range(s_curve_noise_umap$UMAP1))
num_bins_x <- 4
hb_obj <- hex_binning(data = s_curve_noise_umap_scaled, bin1 = num_bins_x,
r2 = r2)
all_centroids_df <- hb_obj$centroids
counts_df <- hb_obj$std_cts
df_bin_centroids <- extract_hexbin_centroids(centroids_df = all_centroids_df,
counts_df = counts_df) |>
dplyr::filter(drop_empty == FALSE)
tr1_object <- tri_bin_centroids(hex_df = df_bin_centroids, x = "c_x", y = "c_y")
gen_edges(tri_object = tr1_object)
#> # A tibble: 23 × 6
#>     from    to  x_from y_from  x_to  y_to
#>    <int> <int>   <dbl>  <dbl> <dbl> <dbl>
#>  1     1     4  0.0915  0.130 0.283 0.461
#>  2     2     4  0.474   0.130 0.283 0.461
#>  3     3     5 -0.1     0.461 0.474 0.793
#>  4     4     6  0.283   0.461 0.857 0.793
#>  5     3     9 -0.1     0.461 0.666 1.79 
#>  6     5     7  0.474   0.793 0.666 1.12 
#>  7     7     8  0.666   1.12  0.857 1.46 
#>  8     5     9  0.474   0.793 0.666 1.79 
#>  9     9    10  0.666   1.79  1.05  1.79 
#> 10     8    10  0.857   1.46  1.05  1.79 
#> # ℹ 13 more rows