R/sphericity.R

Defines functions sphericity

Documented in sphericity

#' Calculate sphericity of a 3D object
#'
#' @description Calculates the ratio of the surface area of a sphere with the same volume as the object and the surface area of the object.
#'
#' @param mesh A triangular mesh of class mesh3d.
#'
#' @return Sphericity value.
#' @export
#'
#' @seealso [circularity()]
#'
#' @examples
#' sphericity(mcap)

sphericity <- function(mesh) {
  sa <- suppressWarnings(Rvcg::vcgArea(mesh))
  vol <- suppressWarnings(Rvcg::vcgVolume(mesh))
  ((pi^(1/3))*((6*vol)^(2/3)))/sa
}

Try the habtools package in your browser

Any scripts or data that you put into this service are public.

habtools documentation built on May 29, 2024, 7:30 a.m.