rename to adze
This commit is contained in:
parent
5bb2d2464f
commit
31d24ed9d3
11 changed files with 114 additions and 9 deletions
55
README.md
Normal file
55
README.md
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# adze
|
||||
|
||||
**adze** is a Python package for accurate polyhedron clipping
|
||||
and anti-aliased voxelization.
|
||||
|
||||
**Homepage:** https://mpxd.net/code/jan/adze
|
||||
|
||||
**Capabilities:**
|
||||
- Clipping or splitting arbitrary polyhedra
|
||||
- by a plane or a collection of planes (i.e. a convex polyhedron)
|
||||
- Voxelizing arbitrary polyhedra
|
||||
-
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
**Dependencies:**
|
||||
* python 3.5 or newer
|
||||
* numpy
|
||||
|
||||
|
||||
Install with pip from PyPi (preferred):
|
||||
```bash
|
||||
pip install adze
|
||||
```
|
||||
|
||||
Install directly from git repository:
|
||||
```bash
|
||||
pip install git+https://mpxd.net/code/jan/adze.git@release
|
||||
```
|
||||
|
||||
## Documentation
|
||||
Most functions and classes are documented inline.
|
||||
|
||||
To read the inline help,
|
||||
```python3
|
||||
import adze
|
||||
help(adze)
|
||||
help(adze.split)
|
||||
```
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
TODO
|
||||
Read an OASIS file and write it back out:
|
||||
```python3
|
||||
import fatamorgana
|
||||
|
||||
with open('test.oas', 'rb') as f:
|
||||
layout = fatamorgana.OasisLayout.read(f)
|
||||
|
||||
with open('test_write.oas', 'wb') as f:
|
||||
layout.write(f)
|
||||
```
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
'''
|
||||
|
||||
Library for accurate polyhedron clipping and anti-aliased voxelization.
|
||||
adze is a library for accurate polyhedron clipping and anti-aliased voxelization.
|
||||
Written with python + numpy.
|
||||
|
||||
Most operations are performed using an ordered adjacency-list polyhedron represenation,
|
||||
|
|
@ -19,9 +18,9 @@ Basic operations include
|
|||
same_side_as_normal = clip(poly, plane)
|
||||
|
||||
volume = get_volume(poly)
|
||||
volume, m_x, m_y, m_z = get_moments(poly, order=1)
|
||||
volume, m_x, m_y, m_z = get_moments(poly, order=1)
|
||||
|
||||
Anti-aliased voxelization is done on a non-uniform rectangular grid, specified by the cell
|
||||
Anti-aliased voxelization is done on a non-uniform rectangular grid, specified by the cell
|
||||
edge coordinates:
|
||||
x_planes = numpy.linspace(-5, 5, 100)
|
||||
y_planes = numpy.linspace(-10, 10, 5)
|
||||
|
|
@ -43,12 +42,15 @@ In the polyhedron representation returned by the build_* functions and accepted
|
|||
most other functions (split, clip, get_volume, get_moments, voxelize), the
|
||||
polyhedron is stored as a 3-vertex-connected, triply-linked graph, with each vertex's
|
||||
neighbors listed in counterclockwise order when viewed from outside the polyhedron. TODO
|
||||
Each graph-vertex (g-vertex) is connected to exactly 3 other g-vertices, and
|
||||
Each graph-vertex (g-vertex) is connected to exactly 3 other g-vertices; polygon-
|
||||
vertices (p-vertices) are
|
||||
|
||||
|
||||
TODO
|
||||
This
|
||||
representation looks like
|
||||
poly = {'neighbors': ndarray[Px3, int], 'vertices': ndarray[Px3, float]}
|
||||
where poly['neighbors'] contains
|
||||
where poly['neighbors'] contains
|
||||
|
||||
'''
|
||||
|
||||
48
setup.py
Normal file
48
setup.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(name='adze',
|
||||
version='0.1',
|
||||
description='Polyhedron clipping and antialiased voxelization',
|
||||
author='Jan Petykiewicz',
|
||||
author_email='anewusername@gmail.com',
|
||||
url='https://mpxd.net/code/jan/adze',
|
||||
keywords=[
|
||||
'geometry',
|
||||
'geometric',
|
||||
'polyhedron',
|
||||
'voxel',
|
||||
'voxelize',
|
||||
'clip',
|
||||
'clipping',
|
||||
'split',
|
||||
'moment',
|
||||
'schlegel',
|
||||
'3D',
|
||||
'boolean',
|
||||
],
|
||||
classifiers=[
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Development Status :: 4 - Beta',
|
||||
'Environment :: Other Environment',
|
||||
'Intended Audience :: Developers',
|
||||
'Intended Audience :: Science/Research',
|
||||
'License :: OSI Approved',
|
||||
'License :: OSI Approved :: GNU Affero General Public License v3',
|
||||
'Operating System :: OS Independent',
|
||||
'Topic :: Multimedia :: Graphics',
|
||||
'Topic :: Scientific/Engineering',
|
||||
'Topic :: Scientific/Engineering :: Mathematics',
|
||||
'Topic :: Software Development :: Libraries :: Python Modules',
|
||||
],
|
||||
packages=find_packages(),
|
||||
install_requires=[
|
||||
'typing',
|
||||
'numpy',
|
||||
],
|
||||
extras_require={
|
||||
},
|
||||
)
|
||||
|
||||
|
|
@ -7,10 +7,10 @@ import numpy
|
|||
from numpy import sin, cos, pi
|
||||
from numpy.linalg import norm
|
||||
|
||||
from chop import (number_of_moments, get_moments, split, clip, build_tetrahedron,
|
||||
from adze import (number_of_moments, get_moments, split, clip, build_tetrahedron,
|
||||
build_box, planes_from_tetrahedron, build_polyhedron, boundary_from_poly,
|
||||
voxelize)
|
||||
from chop.util import check_poly
|
||||
from adze.util import check_poly
|
||||
|
||||
try:
|
||||
# Check if running with line_profiler
|
||||
|
|
@ -547,7 +547,7 @@ if __name__ == '__main__':
|
|||
test_recursive_split()
|
||||
|
||||
logger.info('voxelization')
|
||||
test_voxelization()
|
||||
# test_voxelization()
|
||||
|
||||
logger.info('test_tet_tet_timing')
|
||||
test_tet_tet_timing()
|
||||
|
|
|
|||
Loading…
Reference in a new issue