Cython-CSG
Cython port of Evan Wallace’s Javascript https://github.com/evanw/csg.js/ and Tim Knip raw Python version https://github.com/timknip/pycsg.
What is Cython-CSG
CSG stands for Constructive Solid Geometry. It allow Boolean operations to be made on a 3D object like subtraction.
Usage
Subtraction
A simple subtraction is as followed
from _cython_csg import CSG
a = CSG.cube()
b = CSG.cube([0.5, 0.5, 0.0])
c = a - b
c.saveVTK('subtract.vtk')
Union
A Simple Union would is as followed
from _cython_csg import CSG
a = CSG.sphere(center=[0.5, 0.5, 0.5], radius=0.5, slices=8, stacks=4)
b = CSG.cylinder(start=[0.,0.,0.], end=[1.,0.,0.], radius=0.3, slices=16)
a.union(b).saveVTK('union.vtk')
Custom objects
You can make custom object here is a example
from _cython_csg import BSPNode, Polygon, Vertex
v0 = Vertex([0., 0., 0.])
v1 = Vertex([1., 0., 0.])
v2 = Vertex([1., 1., 0.])
p0 = Polygon([v0, v1, v2])
polygons = [p0]
node = BSPNode(polygons)
if you then want to convert it back to a CSG object you can do
CSG.fromPolygons(node)
Install
To build run
python setup.py build
python setup.py install
Other Notes
To view the output I would recommend a program like ParaView
Help required
Patches are welcome for the source code or for the documentation
Metadata
Release files for cython-csg 0.5.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cython-csg-0.5.8.tar.gz | 160.5 kB | Without provenance | Details |
Release files / cython-csg-0.5.8.tar.gz
| Download URL | cython-csg-0.5.8.tar.gz |
|---|---|
| Size | 160.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45a656b6603caf5fe01ce99cbf24f869955256daae2e74e423152eeb0d2d496d
|
|
BLAKE2b-256 checksum How to use checksums |
118d09c70abf3be3c8b3fc0017408c681894a22ae148d422d76f154919d2da37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for cython-csg 0.5.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.