Skip to contents

This function generates a uniform grid of points within a specified region of interest (ROI). The grid is created based on user-defined step sizes for the x and y dimensions.

Usage

make_grid(roi, step_x, step_y)

Arguments

roi

A list containing:

  • x: A numeric vector of length 2 specifying the x-axis range (xmin, xmax).

  • y: A numeric vector of length 2 specifying the y-axis range (ymin, ymax).

step_x

Numeric. The step size for x-coordinates (grid resolution along the x-axis).

step_y

Numeric. The step size for y-coordinates (grid resolution along the y-axis).

Value

A data frame containing all grid points with columns:

  • x: The x-coordinates of the grid points.

  • y: The y-coordinates of the grid points.

See also

seek_inflection, which utilizes this function to generate search grids.

Examples

roi <- list(x = c(1, 5), y = c(2, 6))
grid <- make_grid(roi, step_x = 0.5, step_y = 0.5)
print(grid)
#>      x   y
#> 1  1.0 2.0
#> 2  1.5 2.0
#> 3  2.0 2.0
#> 4  2.5 2.0
#> 5  3.0 2.0
#> 6  3.5 2.0
#> 7  4.0 2.0
#> 8  4.5 2.0
#> 9  5.0 2.0
#> 10 1.0 2.5
#> 11 1.5 2.5
#> 12 2.0 2.5
#> 13 2.5 2.5
#> 14 3.0 2.5
#> 15 3.5 2.5
#> 16 4.0 2.5
#> 17 4.5 2.5
#> 18 5.0 2.5
#> 19 1.0 3.0
#> 20 1.5 3.0
#> 21 2.0 3.0
#> 22 2.5 3.0
#> 23 3.0 3.0
#> 24 3.5 3.0
#> 25 4.0 3.0
#> 26 4.5 3.0
#> 27 5.0 3.0
#> 28 1.0 3.5
#> 29 1.5 3.5
#> 30 2.0 3.5
#> 31 2.5 3.5
#> 32 3.0 3.5
#> 33 3.5 3.5
#> 34 4.0 3.5
#> 35 4.5 3.5
#> 36 5.0 3.5
#> 37 1.0 4.0
#> 38 1.5 4.0
#> 39 2.0 4.0
#> 40 2.5 4.0
#> 41 3.0 4.0
#> 42 3.5 4.0
#> 43 4.0 4.0
#> 44 4.5 4.0
#> 45 5.0 4.0
#> 46 1.0 4.5
#> 47 1.5 4.5
#> 48 2.0 4.5
#> 49 2.5 4.5
#> 50 3.0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