Skip to content

Commit

Permalink
try to get better data for soap films
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinsimpson committed Jul 17, 2024
1 parent a90abe2 commit c1febab
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions R/smooth-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit c1febab

Please sign in to comment.