Skip to main content

Marching cubes on sparse matrices

Project description

sparse-cubes

Marching cubes for sparse matrices - i.e. (N, 3) voxel data.

Running marching cubes directly on sparse voxels is faster and importantly much more memory efficient than converting to a 3d matrix and using the implementation in e.g. sklearn.

The only dependencies are numpy and trimesh. Will use fastremap if present.

Install

pip3 install git+https://github.com/navis-org/sparse-cubes.git

Usage

>>> import sparsecubes as sc
>>> import numpy as np
>>> voxels = np.array([[0, 0, 0], [0, 0, 1]])
>>> m = sc.marching_cubes(voxels)
>>> m
<trimesh.Trimesh(vertices.shape=(12, 3), faces.shape=(20, 3))>
>>> m.is_winding_consistent
True

Notes

  • The mesh might have non-manifold edges. Trimesh will report these meshes as not watertight but in the very literal definition they do hold water.
  • Currently only full edges.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sparse-cubes-0.1.0.tar.gz (18.2 kB view hashes)

Uploaded source

Built Distribution

sparse_cubes-0.1.0-py3-none-any.whl (17.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page