Generates new versions of 3D meshes (.obj, .ply or .stl) in a selected directory. The vertex count in the new meshes is reduced to the smallest vertex count amongst the selected meshes. Users may scale the vertex count down further. Vertices in the new meshes are approximately uniformly distributed. Meshes are automatically exported in polygon file format (.ply). decMesh is useful for studies that want to reduce the vertex count of 3D meshes before applying whole-mesh analyses (e.g. Generalized Procrustes Surface Analysis from Pomidor et al. 2016).

decMesh(dirpath, scale = 1, vsize = 0.25)

Arguments

dirpath

the directory path where 3D meshes with .obj, .ply, or .stl extensions will be found

scale

a proportion for specifying how the vertex counts in the new versions of the 3D meshes should be scaled relative to the smallest vertex count amongst the 3D meshes. For scale = 1 (default), all new versions of meshes will have vertex counts that are similar to the vertex count of the smallest mesh. decMesh expects a scale value to be between 0 and 1

vsize

a constant used to start the remesh process. Default is 0.25. Should only need to be adjusted during function troubleshooting

Details

decMesh can be used for 3D mesh preprocessing before computationally demanding analyses. decMesh is a wrapper for pcAlign from the Morpho package (Schlager, 2017) and vcgImport, vcgPlyWrite, vcgQEdecim and vcgUniformRemesh from the Rvcg package (Schlager, 2017). Users may consider Instant Meshes as an alternative to decMesh (Wenzel et al. 2015).

Note

Function involves several iterative steps and can therefore be slow.

References

Pomidor BJ, Makedonska J, Slice DE. 2016. A landmark-free method for three-dimensional shape analysis. PLoS One 11: e0150368 https://doi.org/10.1371/journal.pone.0150368

Schlager S. 2017. Morpho and Rvcg-shape analysis in R. In Zheng G, Li S, Sz?kely (eds.) Statistical shape and deformation analysis. Academic Press, London. Pp. 217-256.

Wenzel J, Tarini M, Panozzo D, Sorkine-Hormung O. 2015. Instant field-alighed meshes. ACM Transactions on Graphics (Proceedings of SIGGRAPH Asia 2015) 34: 189-181.

Examples

if (FALSE) { # Any directory path where 3D meshes with .obj, .ply, or .stl extensions will be found path <- "/." # Example 1 # Vertex count in new meshes becomes the same as the smallest vertex count amongst meshes decMesh(path) # Example 2 # Vertex count in new meshes becomes 10 percent of smallest vertex count amongst meshes decMesh(path, scale = 0.1) }