Skip to contents

This function triangulates the bin centroids using the x and y coordinates provided in the input data frame and returns the triangular object.

Usage

tri_bin_centroids(hex_df, x, y)

Arguments

hex_df

The tibble containing the bin centroids.

x

The name of the column that contains x coordinates of bin centroids.

y

The name of the column that contains y coordinates of bin centroids.

Value

A triangular object representing the triangulated bin centroids.

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)
tri_bin_centroids(hex_df = df_bin_centroids, x = "c_x", y = "c_y")
#> Delaunay triangulation, node and triangle indices:
#> triangle: nodes (a,b,c), neighbour triangles [i,j,k] 
#> 1: (1,2,5), [2,4,0]
#> 2: (6,5,2), [1,3,6]
#> 3: (3,6,2), [2,0,9]
#> 4: (9,1,5), [1,5,0]
#> 5: (5,10,9), [10,4,6]
#> 6: (5,6,10), [7,5,2]
#> 7: (11,10,6), [6,8,12]
#> 8: (6,7,11), [18,7,9]
#> 9: (6,3,7), [15,8,3]
#> 10: (13,9,10), [5,11,19]
#> 11: (10,14,13), [21,10,12]
#> 12: (10,11,14), [13,11,7]
#> 13: (15,14,11), [12,16,22]
#> 14: (8,7,4), [15,0,17]
#> 15: (4,7,3), [9,0,14]
#> 16: (11,12,15), [25,13,18]
#> 17: (8,12,7), [18,14,26]
#> 18: (11,7,12), [17,16,8]
#> 19: (17,9,13), [10,20,0]
#> 20: (18,17,13), [19,21,27]
#> 21: (18,13,14), [11,23,20]
#> 22: (14,15,19), [30,23,13]
#> 23: (14,19,18), [28,21,22]
#> 24: (20,15,16), [25,39,30]
#> 25: (15,12,16), [26,24,16]
#> 26: (16,12,8), [17,0,25]
#> 27: (21,17,18), [20,31,33]
#> 28: (22,18,19), [23,32,31]
#> 29: (23,19,20), [30,38,32]
#> 30: (20,19,15), [22,24,29]
#> 31: (22,21,18), [27,28,35]
#> 32: (23,22,19), [28,29,40]
#> 33: (25,17,21), [27,34,0]
#> 34: (26,25,21), [33,35,42]
#> 35: (26,21,22), [31,36,34]
#> 36: (27,26,22), [35,40,44]
#> 37: (28,23,24), [38,48,41]
#> 38: (24,23,20), [29,39,37]
#> 39: (24,20,16), [24,0,38]
#> 40: (27,22,23), [32,41,36]
#> 41: (28,27,23), [40,37,45]
#> 42: (29,25,26), [34,43,0]
#> 43: (30,29,26), [42,44,0]
#> 44: (30,26,27), [36,46,43]
#> 45: (27,28,31), [47,46,41]
#> 46: (27,31,30), [0,44,45]
#> 47: (32,31,28), [45,48,0]
#> 48: (32,28,24), [37,0,47]
#> boundary nodes:  1 2 3 4 8 16 24 32 31 30 29 25 17 9