decimMesh.character: Decimates Several Meshes

Description Usage Arguments Details Value See Also Examples

View source: R/utils_mesh.R

Description

Wrapper for the function decimMesh.mesh3d to decimate a set of mesh files contained within a directory.

Usage

1
2
3
## S3 method for class 'character'
decimMesh(M, tarface=15000, sdir=getwd(), patt=".ply", deci.suffix=NULL,
          deci.dir="DecimMesh", verbose = TRUE, ...)

Arguments

M

A character value indicating either a mesh filename to decimated within sdir, or a directory name within sdir containing the subdirectory M with the mesh files to decimate.

tarface

An integer numerical value for the targetted number of faces for decimation (if superior or equal to the number of faces in M, then no decimation is performed).

sdir

A character value indicating the directoy name containg eiher the mesh filename M to decimate, or the subdirectory name with the mesh files to decimate.

patt

A character value within {".ply",".stl"} indicating the kind of mesh file to open.

deci.suffix

A character value indicating the suffix added at the end of the decimated mesh filenames and before the ".ply" exension. Set to NULL by default.

deci.dir

A character value indicating the name of the subdirectory in M where the decimated mesh will be saved. By default, deci.dir is set to "DecimMesh", meaning that a subdirectory named "DecimMesh" will be automatically created within M (if it doesn't exist yet).

verbose

Possible settings are:
- a logical value: in this case this value should be recycled in a 2 length vector indicating for 2 levels of verbose if comments should be printed or not on screen as the computations are processed. The firs level corresponds to comments specific to the functions from the digit3DLand library, and the second one to comments specific to the functions from the Rvcg library.
- a 2-length logical vector standing for the 2 possible levels of verbose. a logical vector

...

Optional arguments for vcgQEdecim).

Details

This function is a wrapper for decimMesh.mesh3d (itself a wrapper for vcgQEdecim), calling it to treat a list of full mesh files, which will be decimated the one after the other. It looks in the directory sdir for either a mesh filename specified by the character value stored in M, or a subdirectory whose name stored in M that contains the mesh files to decimate. By default, the level of decimation is set by the target argument, but other settings are possible (see vcgQEdecim). Decimated mesh are then saved either in the same directory than full meshes, by adding a suffix in decimated mesh filenames (to distinguish them from full mesh filenames), or in a separate subfolder (contained in the directory for full meshes). Both ply and stl mesh files are supported (but decimated meshes will be uniquely saved as ply).

Value

A list of decimated mesh3d objects.

See Also

decimMesh.mesh3d.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run:

# 1st example: decimating a mesh file
# A basic call consists in giving the filename of the mesh to decimate (contained in the working directory):
L <- decim("mesh2decimate.ply")

# 2nd example: decimating mesh files in a given directory
# If the working directory contains a subdirectory named "fold" with the full resolution mesh files to decimate, a basic call of the function is:
L <- decim("fold")

# 3rd example: decimating mesh files following a targetted face number percentage (see the help of vcgQEdecim for details):
L <- decim("fold", percent = 0.3)

# 4th example: decimating stl files (contined in the "fold4stl" folder):
L <- decim("fold4stl", patt=".stl")

# 5th example: saving decimating meshes in the same folder as the full meshes by sepcifying their suffix:
L <- decim("fold", deci.suffix="suffix4decimatedMesh", deci.dir=NULL)

## End(Not run)

morphOptics/digit3DLand documentation built on July 17, 2021, 8:27 p.m.