Skip to content

Commit

Permalink
Merge pull request #2276 from mikedh/feat/stride
Browse files Browse the repository at this point in the history
Release: Stride Speedup + Hints
  • Loading branch information
mikedh authored Aug 30, 2024
2 parents e8a43dd + d8a646b commit f7df971
Show file tree
Hide file tree
Showing 14 changed files with 249 additions and 175 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
name: Check Code Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Formatting
Expand All @@ -38,9 +38,9 @@ jobs:
- os: macos-13
python-version: 3.9
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test a minimal install
Expand All @@ -57,9 +57,9 @@ jobs:
needs: [tests, containers]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install publishing dependencies
Expand All @@ -81,7 +81,7 @@ jobs:
- name: Log In to Docker Hub
run: echo ${{ secrets.DH_PASS }} | docker login --username mikedh --password-stdin
- name: Checkout trimesh
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build Images And Docs
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -104,15 +104,15 @@ jobs:
runs-on: ubuntu-latest
name: Check Corpus Loading
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Trimesh DiskCache
id: cache-resolvers
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.trimesh-cache
key: trimesh-cache
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Trimesh
Expand All @@ -128,7 +128,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Tag Version
id: set_tag
run: |
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
name: Check Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install
Expand All @@ -28,9 +28,9 @@ jobs:
python-version: ["3.8", "3.12"]
os: [ubuntu-latest, windows-latest, macos-13]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test a minimal install
Expand All @@ -46,23 +46,23 @@ jobs:
name: Run Tests In Docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run Pytest In Docker
run: make tests

corpus:
runs-on: ubuntu-latest
name: Check Corpus Loading
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Trimesh DiskCache
id: cache-resolvers
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.trimesh-cache
key: trimesh-cache
- name: Set up Python 3.11
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Trimesh
Expand Down
23 changes: 20 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ RUN useradd -m -u 499 -s /bin/bash user && \
USER user

WORKDIR /home/user

# install a python `venv`
# this seems a little silly since we're already in a container
# but if you use Debian methods like `update-alternatives`
# it won't provide a `pip` which works easily and it isn't
# easy to know how system packages interact with pip packages
RUN python3.12 -m venv venv

# So scripts installed from pip are in $PATH
Expand All @@ -23,13 +29,25 @@ COPY --chmod=755 docker/trimesh-setup /home/user/venv/bin
## install things that need building
FROM base AS build

USER root
# install wget for fetching wheels
RUN apt-get update && \
apt-get install --no-install-recommends -qq -y wget ca-certificates && \
apt-get clean -y
USER user

# copy in essential files
COPY --chown=499 trimesh/ /home/user/trimesh
COPY --chown=499 pyproject.toml /home/user/

# install trimesh into .local
# install trimesh into the venv
RUN pip install /home/user[easy]

# install FCL, which currently has broken wheels on pypi
RUN wget https://github.com/BerkeleyAutomation/python-fcl/releases/download/v0.7.0.7/python_fcl-0.7.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl && \
pip install python_fcl*.whl && \
rm python_fcl*.whl

####################################
### Build output image most things should run on
FROM base AS output
Expand All @@ -55,8 +73,7 @@ RUN trimesh-setup --install=test,gmsh,gltf_validator,llvmpipe,binvox
USER user

# install things like pytest and make sure we're on Numpy 2.X
# todo : imagio is forcing a downgrade of numpy 2 in-place
RUN pip install .[all] && pip install --force-reinstall --upgrade "numpy>2" && \
RUN pip install .[all] && \
python -c "import numpy as n; assert(n.__version__.startswith('2'))"

# check for lint problems
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = ["setuptools >= 61.0", "wheel"]
[project]
name = "trimesh"
requires-python = ">=3.8"
version = "4.4.7"
version = "4.4.8"
authors = [{name = "Michael Dawson-Haggerty", email = "[email protected]"}]
license = {file = "LICENSE.md"}
description = "Import, export, process, analyze and view triangular meshes."
Expand Down Expand Up @@ -90,7 +90,8 @@ recommend = [
"pyglet<2",
"psutil",
"scikit-image",
"python-fcl", # do collision checks
"fast-simplification",
# "python-fcl", # do collision checks # TODO : broken on numpy 2
"openctm", # load `CTM` compressed models
"cascadio", # load `STEP` files

Expand Down Expand Up @@ -159,7 +160,6 @@ flake8-implicit-str-concat = {"allow-multiline" = false}
"IPython.embed".msg = "you forgot to remove a debug embed ;)"
"numpy.empty".msg = "uninitialized arrays are haunted try numpy.zeros"


[tool.codespell]
skip = "*.js*,./docs/built/*,./docs/generate/*,./models*,*.toml"
ignore-words-list = "nd,coo,whats,bu,childs,mis,filetests"
Expand All @@ -169,4 +169,4 @@ python_version = "3.8"
ignore_missing_imports = true
disallow_untyped_defs = false
disallow_untyped_calls = false
disable_error_code = ["method-assign"]
disable_error_code = ["method-assign", "var-annotated"]
28 changes: 28 additions & 0 deletions tests/test_quadric.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
try:
from . import generic as g
except BaseException:
import generic as g


def test_quadric_simplification():
if not g.trimesh.util.has_module("fast_simplification"):
return

m = g.get_mesh("rabbit.obj")
assert len(m.faces) > 600

# should be about half as large
a = m.simplify_quadric_decimation(percent=0.5)
assert g.np.isclose(len(a.faces), len(m.faces) // 2, rtol=0.2)

# should have the requested number of faces
a = m.simplify_quadric_decimation(face_count=200)
assert len(a.faces) == 200

# see if aggression does anything
a = m.simplify_quadric_decimation(percent=0.25, aggression=5)
assert len(a.faces) > 0


if __name__ == "__main__":
test_quadric_simplification()
Loading

0 comments on commit f7df971

Please sign in to comment.