Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: Pip
on:
workflow_dispatch:
pull_request:
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
29 changes: 9 additions & 20 deletions .github/workflows/wheels.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
name: Wheels

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
release:
types:
- published

- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -38,15 +33,12 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-latest, macos-14]

steps:
- uses: actions/checkout@v3

- uses: pypa/cibuildwheel@v2.10.1
env:
CIBW_ARCHS_MACOS: auto universal2
CIBW_SKIP: pp37-win_amd64
- uses: pypa/cibuildwheel@v2.17.0

- name: Verify clean directory
run: git diff --exit-code
Expand All @@ -59,22 +51,19 @@ jobs:


upload_all:
name: Upload if release
name: Release To PyPi
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

permissions:
id-token: write
steps:
- uses: actions/setup-python@v4
with:
python-version: "3.x"
python-version: "3.12"

- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.5.1
with:
user: thomwolf
password: ${{ secrets.pypi_password }}
- uses: pypa/gh-action-pypi-publish@v1.8.10
61 changes: 0 additions & 61 deletions .vscode/settings.json

This file was deleted.

31 changes: 31 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,34 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


Additionally, the V-HACD header-only C++ library (src/vhacdx/VHACD.h) is:


Copyright (c) 2011 Khaled Mamou (kmamou at gmail dot com)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. The names of the contributors may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 changes: 3 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# pyVHACD
# vhacdx
Python bindings for V-HACD

A very simple and raw python binding for V-HACD (https://github.com/kmammou/v-hacd)

Generate a set of convex hulls for a triangulated mesh.
A very simple and raw python binding for [V-HACD](https://github.com/kmammou/v-hacd) that is forked from [thomwolf/pyVHACD](https://github.com/thomwolf/pyVHACD) which generates an approximate convex decomposition of a triangle mesh.

Contains a single method: `output = compute_vhacd(points, faces)` which take as inputs:
- points: a (N, 3) Numpy array of double containing the coordinates of the N vertex of the mesh
Expand All @@ -13,23 +11,5 @@ Gives as output a list (number of convex hulls) of pairs of points-faces for eac

# To install
```
pip install pyVHACD
```

# To use

Examples usage with pyvista:
```
import pyvista
import pyVHACD

mesh = pyvista.examples.download_bunny().triangulate()

outputs = pyVHACD.compute_vhacd(mesh.points, mesh.faces)

plotter = pyvista.Plotter(window_size=(1500, 1100))
for i, (mesh_points, mesh_faces) in enumerate(outputs):
plotter.add_mesh(pyvista.PolyData(mesh_points, mesh_faces), color=list(pyvista.hexcolors.keys())[i])

plotter.show()
pip install vhacdx
```
61 changes: 58 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,65 @@
[build-system]
requires = [
"setuptools>=42",
"pybind11>=2.10.0",
"wheel",
"pybind11>=2.12.0",
]
build-backend = "setuptools.build_meta"


[project]
name = "vhacdx"
version = "0.0.7"
requires-python = ">=3.7"

authors = [{name = "Thomas Wolf", email = "thomas@huggingface.co"}]
description = "Python bindings for VHACD"
urls = {Homepage = "https://github.com/trimesh/vhacdx"}
dependencies = ["numpy"]

[project.readme]
file = "README.md"
content-type = "text/markdown"

[options]
zip_safe = false

[project.optional-dependencies]
test = ["pytest"]

[tool.cibuildwheel]
test-command = "python {project}/tests/test.py"
test-skip = "*universal2:arm64"
test-requires = "pytest"
test-command = "pytest {project}/tests"

# skip platforms that don't have numpy wheels
test-skip = "*universal2:arm64 pp31* *i686 *musllinux*"
skip = "pp37-win_amd64"

[tool.ruff]
target-version = "py37"
# See https://github.com/charliermarsh/ruff#rules for error code definitions.
select = [
# "ANN", # annotations
"B", # bugbear
"C", # comprehensions
"E", # style errors
"F", # flakes
"I", # import sorting
"RUF100", # meta
"U", # upgrade
"W", # style warnings
"YTT", # sys.version
]

ignore = [
"C901", # Comprehension is too complex (11 > 10)
"N802", # Function name should be lowercase
"N806", # Variable in function should be lowercase
"E501", # Line too long ({width} > {limit} characters)
"B904", # raise ... from err
"B905", # zip() without an explicit strict= parameter
"ANN101", # type hint for `self`
"ANN002", # type hint for *args
"ANN003", # type hint for **kwargs
]
line-length = 90
46 changes: 17 additions & 29 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
import sys

from pybind11 import get_cmake_dir
# Available at setup time due to pyproject.toml
import os

from pybind11.setup_helpers import Pybind11Extension, build_ext
from setuptools import setup

__version__ = "0.0.2"
# get version from pyproject.toml to pass in to build macro
with open(
os.path.abspath(os.path.join(os.path.dirname(__file__), "pyproject.toml"))
) as f:
__version__ = next(L.split("=")[1].strip().strip('"') for L in f if "version" in L)


# The main interface is through Pybind11Extension.
# * You can add cxx_std=11/14/17, and then build_ext can be removed.
# * You can set include_pybind11=false to add the include directory yourself,
# say from a submodule.
#
# Note:
# Sort input source files if you glob sources to ensure bit-for-bit
# reproducible builds (https://github.com/pybind/python_example/pull/53)

ext_modules = [
Pybind11Extension("pyVHACD",
["src/pyVHACD/main.cpp"],
# Example: passing in the version to the compiled code
define_macros = [('VERSION_INFO', __version__)],
),
]

setup(
name='pyVHACD',
version=__version__,
author='Thomas Wolf',
author_email='thomas@huggingface.co',
url='https://github.com/thomwolf/pyVHACD',
description='Python bindings for VHACD',
long_description='Python bindings for VHACD',
ext_modules=ext_modules,
extras_require={"test": ["pytest", "numpy"]},
install_requires=['pybind11>=2.2', 'numpy'],
cmdclass={'build_ext': build_ext},
zip_safe=False,
python_requires=">=3.6",
ext_modules=[
Pybind11Extension(
"vhacdx",
["src/vhacdx/main.cpp"],
# Example: passing in the version to the compiled code
define_macros=[("VERSION_INFO", __version__)],
),
],
cmdclass={"build_ext": build_ext},
)
Loading