Skip to contents

This function calculates the 2-D distances between pairs of points in a data frame.

Usage

calc_2d_dist(
  trimesh_data,
  select_vars = c("from", "to", "x_from", "y_from", "x_to", "y_to", "from_count",
    "to_count", "distance")
)

Arguments

trimesh_data

A tibble that contains the x and y coordinates of start and end points.

select_vars

selected columns in the resulting data frame.

Value

A tibble with columns for the starting point, ending point, and calculated distances.

Examples

tr_from_to_df <- scurve_model_obj$trimesh_data
calc_2d_dist(trimesh_data = tr_from_to_df)
#> # A tibble: 10 × 9
#>     from    to x_from y_from  x_to  y_to from_count to_count distance
#>    <int> <int>  <dbl>  <dbl> <dbl> <dbl>      <dbl>    <dbl>    <dbl>
#>  1     2     6  0.442 0.101  0.400 0.173         11       11   0.0834
#>  2     2     3  0.442 0.101  0.526 0.101         11       12   0.0834
#>  3     7     8  0.567 0.173  0.651 0.173         14       11   0.0834
#>  4     1     4  0.818 0.0288 0.776 0.101         12       12   0.0834
#>  5     4     5  0.776 0.101  0.859 0.101         12       12   0.0834
#>  6     9    10  0.776 0.245  0.734 0.318         11       12   0.0834
#>  7    11    12  0.400 0.751  0.442 0.823         11       12   0.0834
#>  8    13    14  0.109 1.11   0.192 1.11          13       14   0.0834
#>  9     3     7  0.526 0.101  0.567 0.173         12       14   0.0834
#> 10     1     5  0.818 0.0288 0.859 0.101         12       12   0.0834