R/packing.R

Defines functions packing

Documented in packing

#' Calculate packing of 3D object
#'
#' @description
#' The ratio of the surface area of the object and the surface area of the convex hull around the object.
#'
#' @param mesh A triangular mesh of class mesh3d.
#'
#' @return Value of packing.
#' @export
#'
#' @examples
#' packing(mcap)


packing <- function(mesh){
  pts <- mesh_to_points(mesh)
  csa <- geometry::convhulln(pts, options = "FA")$area
  sa <- Rvcg::vcgArea(mesh)
  sa/csa
}

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.