% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/vcg.R
\name{vcg_count_edge_defects}
\alias{vcg_count_edge_defects}
\title{Count boundary and non-manifold edges of a triangular mesh}
\usage{
vcg_count_edge_defects(mesh)
}
\arguments{
\item{mesh}{triangular mesh of class \code{'mesh3d'}.}
}
\value{
A named list with elements \code{boundary_edges} (number of
boundary edges), \code{nonmanifold_edges} (number of non-manifold edges),
and \code{is_closed_manifold} (\code{TRUE} when both counts are zero,
i.e. the mesh is closed and manifold and ready for
\code{\link{mris_inflate}}).
}
\description{
Detects topology defects that prevent a mesh from being a closed,
manifold, genus-0 surface, a hard precondition of algorithms such as
\code{\link{mris_inflate}}.  An edge is a \emph{boundary} edge when it is
referenced by exactly one face (i.e. it bounds a hole), and
\emph{non-manifold} when it is referenced by more than two faces.
}
\examples{
if (is_not_cran()) {

  sphere <- vcg_sphere()
  vcg_count_edge_defects(sphere)

  defective <- vcg_isosurface(left_hippocampus_mask)
  vcg_count_edge_defects(defective)

}

}
