diff --git a/R/smooth-data.R b/R/smooth-data.R index 9901136bc..433f002ab 100644 --- a/R/smooth-data.R +++ b/R/smooth-data.R @@ -181,3 +181,30 @@ newdata # return } + +#' @importFrom mgcv inSide +`soap_film_data` <- function(smooth, + n = 100, + n_2d = NULL, + n_3d = NULL, + n_4d = NULL, + offset = NULL, + include_all = FALSE, + var_order = NULL) { + bnd <- boundary(smooth) + + sub_bnd_data <- function(bnd, n = 100) { + l <- lapply(bnd, \(x) evenly(x, n = n)) + d <- expand.grid(l) |> + as_tibble() + d + } + + bnd_data <- lapply(bnd, FUN = sub_bnd_data, n = n) |> + bind_rows() + + # are points inside boundary? + # Will deal with this in eval_smooth.soap.film because mgcv::inSide has a bad + # design + bnd_data +}