pycork provides a fully compiled interface to the cork boolean library
Project description
Pycork is a Python library offering the functionality of the Cork boolean CSG library in a compiler friendly form suitable across all platforms. The library includes the dependencies for the Multi-Precision Integer and Rationals (MPIR) 3.0 built-in used by the Cork libary. The package aims to provide a simpler route for compiling the package for individuals and in addition, generating python bindings for use across other projects. Refactoring has been authored to tidy up the existing codebase so that it can be built across multiple platforms, in particular Windows, using the CMake build-system. At this stage, no further optimisations or improvements will be made specifically to the cork library, inclusive of its algorithms.
The python bindings are simple and offer access to the core functionality offered by the Cork library to perform boolean operations on watertight meshes. Additionally, it removes the awkward step of generatig .off files that are used in the command-line interface of the Cork library. The user may pass triangular meshes (vertices, tri-faces indices) as numpy arrays to each function.
For further information, see the latest release notes.
Installation
Installation is currently supported on Windows. No special requiremnets are necessary for using pycork, except having the numpy library available. It is recommend to also install the trimesh library to provide an interface to processing meshes as input for pycork.
conda install -c numpy
pip install trimesh
Installation of pycork can then be performed using pre-built python packages using the PyPi repository.
pip install pycork
Alternatively, pycork may be compiled directly from source. Currently the prerequisites are the a compliant c++ build environment, include CMake build system. Currently the package has been tested on Windows 10, using VS2019.
git clone https://github.com/drlukeparry/pycork.git && cd ./pycork
git submodule update --init --recursive
python setup.py install
Usage
The Cork CSG library, by design, has a simple interface for is functionality. Further detailed description of the function is therefore not necessary.
import numpy as np
import trimesh
import pycork
# Note any manifold, watertight mesh can be used in conjuction with the Trimesh library
meshA = trimesh.load_mesh('meshA.off')
meshB = trimesh.load_mesh('meshB.off')
# Extra list of vertices and triangular faces from the meshes
vertsA = meshA.vertices
trisA = meshA.faces
vertsB = meshB.vertices
trisB = meshB.faces
pycork.isSolid(vertsA, trisA)
pycork.isSolid(vertsB, trisB)
#Perform the boolean opertions directly with Cork library
vertsC, trisC = pycork.union(vertsA, trisA,
vertsB, trisB)
vertsD, trisD = pycork.intersection(vertsA, trisA,
vertsB, trisB)
meshC = trimesh.Trimesh(vertices=vertsC, faces=trisC, process=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file pycork-0.1.3-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: pycork-0.1.3-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 221.7 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d5e1be63cb07cea450f9ada9316f538c2b15a49f7a4435da43f07d80aef8572 |
|
MD5 | 137ec9ee9b1ea47c7ca7c3628f32e37c |
|
BLAKE2b-256 | 598606ad6398ea57a4502323e01e49c366e4e16e7a3636852699fa91cf5eebc1 |
File details
Details for the file pycork-0.1.3-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: pycork-0.1.3-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 220.8 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1920e7ab4ee3c77b27f428e28a59fbe2de3853333def524f1b42dde8b19cefc |
|
MD5 | 6daa1fe578580e3093c8026f0e0e088a |
|
BLAKE2b-256 | 2d61ab44d52f98208e607f566dc8e75b095e5ce4ac23b96b013b37a3df788ed3 |
File details
Details for the file pycork-0.1.3-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: pycork-0.1.3-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 221.6 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e488e44c43fdbd5e32daa698ce04778ac665c37e327e9061d827cc82be265f01 |
|
MD5 | db256e1912ebcf77dbbeaf1ce1380790 |
|
BLAKE2b-256 | 600ef0f56883dbe82d36085db8624d82a39bc6ad4ac4271dfe23ba7ef06aa13b |
File details
Details for the file pycork-0.1.3-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: pycork-0.1.3-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 221.7 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54d5be232e9f5483bcdce440d4013a64c668d7b0766c7b4b4379e4a551022884 |
|
MD5 | 8417cfd84d999482b5f4147030e57431 |
|
BLAKE2b-256 | 7b2eda8234cdbdd42bd0842e32cd04f76591976004ec3abc829838e23f382147 |