Skip to content

Commit 1493543

Browse files
authored
Release: Kwarg Passthrough (#2347)
2 parents aed7eee + 7fadb0d commit 1493543

File tree

8 files changed

+33
-19
lines changed

8 files changed

+33
-19
lines changed

Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ COPY --chown=499 pyproject.toml /home/user/
3737
# install trimesh into the venv
3838
RUN pip install /home/user[easy]
3939

40-
# install FCL which currently has broken wheels on PyPi
41-
RUN pip install 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
40+
# install FCL from a hopefully temporary fork
41+
# as the original `python-fcl` currently has broken wheels on PyPi
42+
RUN pip install fclx
4243

4344
####################################
4445
### Build output image most things should run on

docs/content/install.md

-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ If you\'d like most soft dependencies which should install cleanly on Mac, Windo
1818
pip install trimesh[easy]
1919
```
2020

21-
Or if you want the full experience, you can try the `all` extra which includes all the testing and recommended packages:
22-
```
23-
pip install trimesh[all]
24-
```
25-
2621

2722
## Conda Packages
2823

docs/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
pypandoc==1.14
1+
pypandoc==1.15
22
recommonmark==0.7.1
33
jupyter==1.1.1
44

55
# get sphinx version range from furo install
66
furo==2024.8.6
77
myst-parser==4.0.0
8-
pyopenssl==24.3.0
8+
pyopenssl==25.0.0
99
autodocsumm==0.2.14
1010
jinja2==3.1.5
1111
matplotlib==3.10.0

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ requires = ["setuptools >= 61.0", "wheel"]
55
[project]
66
name = "trimesh"
77
requires-python = ">=3.8"
8-
version = "4.6.0"
8+
version = "4.6.1"
99
authors = [{name = "Michael Dawson-Haggerty", email = "[email protected]"}]
1010
license = {file = "LICENSE.md"}
1111
description = "Import, export, process, analyze and view triangular meshes."
@@ -96,7 +96,7 @@ recommend = [
9696
"scikit-image",
9797
"fast-simplification",
9898
# "python-fcl", # do collision checks # TODO : broken on numpy 2
99-
"openctm", # load `CTM` compressed models
99+
"openctm; platform_machine=='x86_64'", # load `CTM` compressed models
100100
"cascadio", # load `STEP` files
101101
]
102102

tests/test_bounds.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def test_obb_mesh_large(self):
2121

2222
# Make sure oriented bound estimation runs within 30 seconds.
2323
assert (
24-
stop - start < 30
25-
), f"Took {stop - start} seconds to estimate the oriented bounding box."
24+
stop - start < 60
25+
), f"Took {stop - start}s to estimate the oriented bounding box."
2626

2727
def test_obb_mesh(self):
2828
"""

tests/test_loaded.py

+12
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ def test_meshio(self):
3131
assert len(m.faces) > 0
3232
assert m.area > 1e-5
3333

34+
def test_load_mesh(self):
35+
# test the influence of the parameter `process` for `load_mesh`
36+
with open(g.os.path.join(g.dir_models, "featuretype.STL"), "rb") as file_obj:
37+
mesh = g.trimesh.load_mesh(file_obj=file_obj, file_type="stl", process=False)
38+
# check that number of vertices is not being reduced
39+
assert len(mesh.vertices) == 10428
40+
41+
with open(g.os.path.join(g.dir_models, "featuretype.STL"), "rb") as file_obj:
42+
mesh = g.trimesh.load_mesh(file_obj=file_obj, file_type="stl", process=True)
43+
# check that number of vertices is being reduced
44+
assert len(mesh.vertices) == 1722
45+
3446
def test_fileobj(self):
3547
# make sure we don't close file objects that were passed
3648
# check load_mesh

trimesh/exchange/load.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import os
3+
from copy import deepcopy
34

45
import numpy as np
56

@@ -210,7 +211,8 @@ def load_scene(
210211
)
211212
elif arg.file_type in mesh_loaders:
212213
# use mesh loader
213-
loaded = _load_kwargs(
214+
parsed = deepcopy(kwargs)
215+
parsed.update(
214216
mesh_loaders[arg.file_type](
215217
file_obj=arg.file_obj,
216218
file_type=arg.file_type,
@@ -219,6 +221,8 @@ def load_scene(
219221
**kwargs,
220222
)
221223
)
224+
loaded = _load_kwargs(**parsed)
225+
222226
elif arg.file_type in compressed_loaders:
223227
# for archives, like ZIP files
224228
loaded = _load_compressed(arg.file_obj, file_type=arg.file_type, **kwargs)

trimesh/visual/color.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -924,12 +924,14 @@ def interpolate(
924924

925925
# make input always float
926926
values = np.asanyarray(values, dtype=np.float64).ravel()
927+
928+
# get both minumium and maximum values for range normalization
929+
v_min, v_max = values.min(), values.max()
927930
# offset to zero
928-
values -= values.min()
929-
# get the value range to avoid dividing by zero
930-
values_ptp = np.ptp(values)
931-
if values_ptp > 0.0:
932-
values /= values_ptp
931+
values -= v_min
932+
# normalize to the 0.0 - 1.0 range
933+
if v_min != v_max:
934+
values /= v_max - v_min
933935

934936
# scale values to 0.0 - 1.0 and get colors
935937
colors = cmap(values)

0 commit comments

Comments
 (0)