Uniformly remeshes vtk surface meshes
This module takes a vtk surface mesh (vtkPolyData) surface and returns a uniformly meshed surface also as a vtkPolyData. It is based on research by: S. Valette, and J. M. Chassery in ACVD.
Much of this code was translated from the C++ source code available on the above website. Cython was used as much of the remeshing process is of an iterative nature. This is currently a work in progress and any bugs within this module do not reflect the true nature of ACVD developed by S. Valette.
Installation is straightforward using pip:
$ pip install PyACVD
You can also visit GitHub to download the latest source and install it running the following from the source directory:
$ pip install .
You will need a working copy of VTK. This can be obtained by either building for the source or installing it using a Python distrubution like Anaconda. The other dependencies are numpy and cython.
You can test if your installation works by running the following tests included in the package.
from PyACVD import Tests # Run Stanford bunny remeshing example Tests.Remesh.Bunny() # Run non-uniform sphere remeshing example Tests.Remesh.Sphere()
This example loads a surface mesh, generates 10000 clusters, and creates a uniform mesh.
from PyACVD import Clustering # Load mesh from file. filename = 'file.stl' stlReader = vtk.vtkSTLReader() stlReader.SetFileName(filename) stlReader.Update() mesh = stlReader.GetOutput() # Create clustering object cobj = Clustering.Cluster(target) # Generate clusters cobj.GenClusters(10000) # Generate uniform mesh cobj.GenMesh() # Get mesh remesh = cobj.ReturnNewMesh() # The clustered original mesh and new mesh can be viewed with: cobj.PlotClusters() # must run cobj.GenClusters first cobj.PlotRemesh() # must run cobj.GenMesh first
Python Algorthim Restrictions
The vtkPolyData mesh should not contain duplicate points (i.e. adjcent faces should share identical points). If not already done so, clean the mesh using vtk.vtkCleanPolyData
The number of resulting points is limited by the available memory of the host computer. If approaching the upper limit of your available memory, reduce the “subratio” option when generating the mesh. As it will be pointed out below, the coarser the mesh, the less accurate the solution.
The input mesh should be composed of one surface. Unexpected behavior may result from a multiple input meshes, though some testing has shown that it is stable.
Holes in the input mesh may not be filled by the module and will result in a non-manifold output.
- Cluster sizes are highly dependent on initial cluster placement.
- Clusters one face (or point) large will generate highly non-uniform meshes.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|PyACVD-0.1.1-cp27-cp27m-win_amd64.whl (3.7 MB) Copy SHA256 hash SHA256||Wheel||2.7||Jun 9, 2017|
|PyACVD-0.1.1-cp35-cp35m-win_amd64.whl (3.7 MB) Copy SHA256 hash SHA256||Wheel||3.5||Jun 9, 2017|
|PyACVD-0.1.1-cp36-cp36m-win_amd64.whl (3.7 MB) Copy SHA256 hash SHA256||Wheel||3.6||Jun 9, 2017|
|PyACVD-0.1.1.tar.gz (3.7 MB) Copy SHA256 hash SHA256||Source||None||Jun 9, 2017|