diff --git a/R/read_fs_surface.R b/R/read_fs_surface.R index 995a62c..31863de 100644 --- a/R/read_fs_surface.R +++ b/R/read_fs_surface.R @@ -1420,3 +1420,18 @@ int.to.col.brainvoyager <- function(int_val) { } +#' @title Stop unless surf is an fs.surface +#' +#' @param surf fs.surface instance or anything else +#' +#' @param param_name character string, used in stop message to identify the parameter. +#' +#' @return Called for the side effect of stopping if surf is not an fs.surface instance. +#' +#' @keywords internal +assert.surface <- function(surface, param_name="surface") { + if(! is.fs.surface(surface)) { + stop(sprintf("Parameter '%s' must be an fs.surface instance.", param_name)); + } + return(invisible(NULL)); +} diff --git a/R/surface_dist.R b/R/surface_dist.R index 085204f..195afe9 100644 --- a/R/surface_dist.R +++ b/R/surface_dist.R @@ -8,6 +8,8 @@ #' #' @return named list with entries: 'vertex_id' integer vector, the index of the closest vertex, and 'dist': double vector, the Euclidian distance to that vertex. #' +#' @family Euclidean distance util functions +#' #' @export #' @importFrom stats dist closest.vert.to.point <- function(surface, point_coords) { @@ -58,6 +60,8 @@ closest.vert.to.point <- function(surface, point_coords) { #' #' @param point_coords double vector of length 3, the xyz coords of a single point. #' +#' @family Euclidean distance util functions +#' #' @return double vector of distances vertexdists.to.point <- function(surface, point_coords) { assert.surface(surface); @@ -76,24 +80,6 @@ vertexdists.to.point <- function(surface, point_coords) { #' @keywords internal euclidian.dist <- function(x1, x2) sqrt(sum((x1 - x2) ^ 2)) - -#' @title Stop unless surf is an fs.surface -#' -#' @param surf fs.surface instance or anything else -#' -#' @param param_name character string, used in stop message to identify the parameter. -#' -#' @return Called for the side effect of stopping if surf is not an fs.surface instance. -#' -#' @keywords internal -assert.surface <- function(surface, param_name="surface") { - if(! is.fs.surface(surface)) { - stop(sprintf("Parameter '%s' must be an fs.surface instance.", param_name)); - } - return(invisible(NULL)); -} - - #' @title Compute Euclidean distance between two vertices v1 and v2. #' #' @param surface an fs.surface instance @@ -102,7 +88,9 @@ assert.surface <- function(surface, param_name="surface") { #' #' @param v2 positive integer, vertex index of v2 #' -#' @return double, the Euclidean distance between v1 and v2. +#' @return double, the Euclidean distance between v1 and v2 +#' +#' @family Euclidean distance util functions #' #' @export vertex.euclid.dist <- function(surface, v1, v2) { diff --git a/man/assert.surface.Rd b/man/assert.surface.Rd index 9532174..6271cce 100644 --- a/man/assert.surface.Rd +++ b/man/assert.surface.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/surface_dist.R +% Please edit documentation in R/read_fs_surface.R \name{assert.surface} \alias{assert.surface} \title{Stop unless surf is an fs.surface} diff --git a/man/closest.vert.to.point.Rd b/man/closest.vert.to.point.Rd index d616731..60b22b9 100644 --- a/man/closest.vert.to.point.Rd +++ b/man/closest.vert.to.point.Rd @@ -17,3 +17,9 @@ named list with entries: 'vertex_id' integer vector, the index of the closest ve \description{ Find vertex index closest to given query coordinate using Euclidean distance. } +\seealso{ +Other Euclidean distance util functions: +\code{\link{vertex.euclid.dist}()}, +\code{\link{vertexdists.to.point}()} +} +\concept{Euclidean distance util functions} diff --git a/man/vertex.euclid.dist.Rd b/man/vertex.euclid.dist.Rd index 3fc06b8..08b2685 100644 --- a/man/vertex.euclid.dist.Rd +++ b/man/vertex.euclid.dist.Rd @@ -14,8 +14,14 @@ vertex.euclid.dist(surface, v1, v2) \item{v2}{positive integer, vertex index of v2} } \value{ -double, the Euclidean distance between v1 and v2. +double, the Euclidean distance between v1 and v2 } \description{ Compute Euclidean distance between two vertices v1 and v2. } +\seealso{ +Other Euclidean distance util functions: +\code{\link{closest.vert.to.point}()}, +\code{\link{vertexdists.to.point}()} +} +\concept{Euclidean distance util functions} diff --git a/man/vertexdists.to.point.Rd b/man/vertexdists.to.point.Rd index 4bdf357..b118931 100644 --- a/man/vertexdists.to.point.Rd +++ b/man/vertexdists.to.point.Rd @@ -17,3 +17,9 @@ double vector of distances \description{ Compute Euclidean distance from all mesh vertices to given point. } +\seealso{ +Other Euclidean distance util functions: +\code{\link{closest.vert.to.point}()}, +\code{\link{vertex.euclid.dist}()} +} +\concept{Euclidean distance util functions}