simplify.mesh.2.5D: Perform the simplification of a mesh, given as an object of...

Description Usage Arguments Value See Also Examples

View source: R/simplification.R

Description

Implementation of a mesh simplification strategy for a surface mesh with associated distributed data. The algorithm works by iteratively collapsing an edge into an internal point. The selection of the edge to contract at each iteration is driven by a cost functional, which measures the loss of geometrical accuracy and data information associated with the collapse. For a detailed description of the algorithm, please refer to:
Dassi, F., Ettinger, B., Perotto, S., Sangalli, L.M. (2015),
A mesh simplification strategy for a spatial regression analysis over the cortical surface of the brain,
Applied Numerical Mathematics, Vol. 90, pp. 111-131.

The whole (computing-intensive) procedure is carried out at the C++ level, thus ensuring high-performance. In detail, the function relies on the class RcppSimplification - a wrapper for the template class simplification<Triangle, MeshType::DATA, DataGeo> provided by the C++ library meshsimplification. Methods of class RcppSimplification are exposed to R through the API supplied by the Rcpp and RcppEigen packages.

Usage

1
simplify.mesh.2.5D(mesh,target,loc=NULL,val=NULL,wgeom=1/3,wdisp=1/3,wequi=1/3,file='')

Arguments

mesh

A mesh.2.5D object, endowed with the following attributes:

  • nnodes: number of nodes in the mesh;

  • nodes: nnodes-by-3 matrix collecting the coordinates of each vertex;

  • ntriangles: number of triangles in the mesh;

  • triangles: a ntriangles-by-3 (when order = 1) or ntriangles-by-6 (when order = 2) matrix. It specifies the triangles giving the row indices in nodes of the triangles vertices and (when order = 2) also of the triangles edges midpoints;

  • order: either '1' or '2'. It specifies whether each mesh triangle should be represented by 3 nodes (the triangle vertices) or by 6 nodes (the triangle vertices and midpoints of the triangle edges). These are respectively used for linear (order = 1) and quadratic (order = 2) Finite Elements. Default is order = 1.

target

Number of nodes which the mesh should feature at the end of the simplification process. In other terms, target is used as stopping criterium: the algorithm stops when the number of nodes in the mesh matches target.

loc

#data-by-3 vector with data locations; default is NULL, i.e. data locations are assumed to coincide with the mesh vertices.

val

#data-by-1 vector with the observations associated with each data point; default is NULL.

wgeom

Weight for the geometric component of the edge cost function; default is 1/3. Note that the all weights should be positive and sum up to one.

wdisp

Weight for the data displacement component of the edge cost function; default is 1/3. Note that the all weights should be positive and sum up to one.

wequi

Weight for the data equidistribution component of the edge cost function; default is 1/3. Note that the all weights should be positive and sum up to one.

file

String specifying the path to the location where the simplified mesh will be stored; the following file formats are supported:

  • AVS UCD ASCII (extension .inp);

  • text files (extension .txt);

  • Legacy VTK (extension .vtk).

Text files are assumed to be structured as the AVS UCD ASCII files (.inp extension). If outfile is not provided, the mesh will not get saved to file but just returned as mesh.2.5D object.

Value

A list equipped with the following fields:

See Also

plot.mesh.2.5D, import.mesh.2.5D

Examples

1
2
3
4
5
6
7
8
## Import the mesh of a pawn 
 data(pawn_250)
## Simplify the mesh down to 200 nodes; assume the components of the
## edge cost functions are equally weighted and that the data locations
## coincide with the vertices of the mesh
out1 <- simplify.mesh.2.5D(mesh, 200)
## Resume the simplification procedure, reducing the mesh down to 150 nodes
out2 <- simplify.mesh.2.5D(out1$mesh, 150, out1$locations)

meshsimp documentation built on June 20, 2017, 9:05 a.m.