Repository: mikedh/trimesh
Pull request #2346 (2025-01-29 17:32:36)

Fix/forward kwargs
With the pull-request https://github.com/mikedh/trimesh/pull/2241, `load_mesh` does not respect the parameter `process` anymore.

With this pull-request, the `kwargs` are being forwarded in `load_stl`.


Patch:
diff --git a/Dockerfile b/Dockerfile
index 7de3bf38..f864e423 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -37,9 +37,8 @@ COPY --chown=499 pyproject.toml /home/user/
 # install trimesh into the venv
 RUN pip install /home/user[easy]
 
-# install FCL from a hopefully temporary fork
-# as the original `python-fcl` currently has broken wheels on PyPi
-RUN pip install fclx
+# install FCL which currently has broken wheels on PyPi
+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
 
 ####################################
 ### Build output image most things should run on
diff --git a/docs/content/install.md b/docs/content/install.md
index c121d543..06e028f6 100644
--- a/docs/content/install.md
+++ b/docs/content/install.md
@@ -18,6 +18,11 @@ If you\'d like most soft dependencies which should install cleanly on Mac, Windo
 pip install trimesh[easy]
 ```
 
+Or if you want the full experience, you can try the `all` extra which includes all the testing and recommended packages:
+```
+pip install trimesh[all]
+```
+
 
 ## Conda Packages
 
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 44919076..934ecbe7 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1,11 +1,11 @@
-pypandoc==1.15
+pypandoc==1.14
 recommonmark==0.7.1
 jupyter==1.1.1
 
 # get sphinx version range from furo install
 furo==2024.8.6
 myst-parser==4.0.0
-pyopenssl==25.0.0
+pyopenssl==24.3.0
 autodocsumm==0.2.14
 jinja2==3.1.5
 matplotlib==3.10.0
diff --git a/pyproject.toml b/pyproject.toml
index eb17f47a..8d5892db 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -96,7 +96,7 @@ recommend = [
     "scikit-image",
     "fast-simplification",
     # "python-fcl", # do collision checks # TODO : broken on numpy 2
-    "openctm; platform_machine=='x86_64'", # load `CTM` compressed models
+    "openctm", # load `CTM` compressed models
     "cascadio", # load `STEP` files
 ]
 
diff --git a/trimesh/exchange/stl.py b/trimesh/exchange/stl.py
index a82a6d0d..b8e6a2ce 100644
--- a/trimesh/exchange/stl.py
+++ b/trimesh/exchange/stl.py
@@ -43,14 +43,14 @@ def load_stl(file_obj, **kwargs):
         # if that is true, it is almost certainly a binary STL file
         # if the header doesn't match the file length a HeaderError will be
         # raised
-        return load_stl_binary(file_obj)
+        return {**load_stl_binary(file_obj), **kwargs}
     except HeaderError:
         # move the file back to where it was initially
         file_obj.seek(file_pos)
         # try to load the file as an ASCII STL
         # if the header doesn't match the file length
         # HeaderError will be raised
-        return load_stl_ascii(file_obj)
+        return {**load_stl_ascii(file_obj), **kwargs}
 
 
 def load_stl_binary(file_obj):
diff --git a/trimesh/visual/color.py b/trimesh/visual/color.py
index 500c25f2..e511d867 100644
--- a/trimesh/visual/color.py
+++ b/trimesh/visual/color.py
@@ -924,12 +924,12 @@ def interpolate(
 
     # make input always float
     values = np.asanyarray(values, dtype=np.float64).ravel()
-
-    v_min, v_max = values.min(), values.max()
     # offset to zero
-    values -= v_min()
-    if v_min != v_max:
-        values /= v_max - v_min
+    values -= values.min()
+    # get the value range to avoid dividing by zero
+    values_ptp = np.ptp(values)
+    if values_ptp > 0.0:
+        values /= values_ptp
 
     # scale values to 0.0 - 1.0 and get colors
     colors = cmap(values)


Test patch:
diff --git a/tests/test_loaded.py b/tests/test_loaded.py
index 09105545..cb6edb2a 100644
--- a/tests/test_loaded.py
+++ b/tests/test_loaded.py
@@ -31,6 +31,18 @@ class LoaderTest(g.unittest.TestCase):
         assert len(m.faces) > 0
         assert m.area > 1e-5
 
+    def test_load_mesh(self):
+        # test the influence of the parameter `process` for `load_mesh`
+        with open(g.os.path.join(g.dir_models, "featuretype.STL"), "rb") as file_obj:
+            mesh = g.trimesh.load_mesh(file_obj=file_obj, file_type="stl", process=False)
+            # check that number of vertices is not being reduced
+            assert len(mesh.vertices) == 10428
+
+        with open(g.os.path.join(g.dir_models, "featuretype.STL"), "rb") as file_obj:
+            mesh = g.trimesh.load_mesh(file_obj=file_obj, file_type="stl", process=True)
+            # check that number of vertices is being reduced
+            assert len(mesh.vertices) == 1722
+
     def test_fileobj(self):
         # make sure we don't close file objects that were passed
         # check load_mesh