Skip to content

Commit a47b66d

Browse files
authored
Merge pull request #2113 from mikedh/up/manifold
Release: update to latest manifold3d API
2 parents 1d0f548 + ee01b14 commit a47b66d

14 files changed

Lines changed: 45 additions & 20 deletions

File tree

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ example_rsts = $(foreach name, $(example_names), examples.$(name).rst)
2121

2222

2323
html: conf.py $(CONTENT)/index.rst trimesh.rst README.rst $(example_rsts) examples.rst .deps
24+
cp -R "$(STATICDIR)" "$(GENDIR)/static"
2425
@$(SPHINXBUILD) -M html "$(GENDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2526
echo "trimesh.org" > "$(BUILDDIR)/html/CNAME"
2627
touch "$(BUILDDIR)/html/.nojekyll"
27-
cp -R "$(STATICDIR)/images" "$(BUILDDIR)/html/images" || true
2828
cp "$(STATICDIR)/favicon.ico" "$(BUILDDIR)/html/favicon.ico" || true
2929

3030
.deps: requirements.txt

docs/conf.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/usr/bin/env python3
2-
import inspect
32
import os
43

54
# get version from trimesh without installing
65
import trimesh
76

7+
_cwd = os.path.abspath(os.path.expanduser(os.path.dirname(__file__)))
88

9-
def abspath(rel):
9+
10+
def abspath(rel: str) -> str:
1011
"""
1112
Take paths relative to the current file and
1213
convert them to absolute paths.
@@ -21,10 +22,8 @@ def abspath(rel):
2122
abspath : str
2223
Absolute path, IE '/home/user/stuff'
2324
"""
24-
2525
# current working directory
26-
cwd = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
27-
return os.path.abspath(os.path.join(cwd, rel))
26+
return os.path.abspath(os.path.join(_cwd, rel))
2827

2928

3029
extensions = [
@@ -66,7 +65,7 @@ def abspath(rel):
6665
# List of patterns, relative to source directory, that match files and
6766
# directories to ignore when looking for source files.
6867
# This patterns also effect to html_static_path and html_extra_path
69-
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
68+
exclude_patterns = ["built", "Thumbs.db", ".DS_Store"]
7069

7170
# The name of the Pygments (syntax highlighting) style to use.
7271
pygments_style = "sphinx"
@@ -85,8 +84,8 @@ def abspath(rel):
8584
# Add any paths that contain custom static files (such as style sheets) here,
8685
# relative to this directory. They are copied after the builtin static files,
8786
# so a file named "default.css" will overwrite the builtin "default.css".
88-
html_static_path = ["static"]
89-
html_logo = "images/trimesh-logo.png"
87+
html_static_path = [abspath("static")]
88+
html_logo = "static/images/trimesh-logo.png"
9089

9190
# custom css
9291
html_css_files = ["custom.css"]

docs/requirements.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
pypandoc==1.11
1+
pypandoc==1.12
22
recommonmark==0.7.1
33
jupyter==1.0.0
44

55
# get sphinx version range from furo install
66
furo==2023.9.10
77
myst-parser==2.0.0
8-
pyopenssl==23.2.0
9-
autodocsumm==0.2.11
10-
jinja2==3.1.2
11-
matplotlib==3.8.0
12-
nbconvert==7.8.0
8+
pyopenssl==23.3.0
9+
autodocsumm==0.2.12
10+
jinja2==3.1.3
11+
matplotlib==3.8.2
12+
nbconvert==7.14.1
1313

models/rock.obj.bz2

508 Bytes
Binary file not shown.

pyproject.toml

Lines changed: 3 additions & 3 deletions
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.7"
8-
version = "4.0.8"
8+
version = "4.0.9"
99
authors = [{name = "Michael Dawson-Haggerty", email = "mikedh@kerfed.com"}]
1010
license = {file = "LICENSE.md"}
1111
description = "Import, export, process, analyze and view triangular meshes."
@@ -77,6 +77,7 @@ easy = [
7777
"scipy",
7878
"embreex",
7979
"pillow",
80+
"vhacdx",
8081
]
8182

8283
recommend = [
@@ -88,8 +89,7 @@ recommend = [
8889
"xatlas",
8990
"scikit-image",
9091
"python-fcl",
91-
"vhacdx",
92-
"manifold3d"
92+
"manifold3d>=2.3.0"
9393
]
9494

9595
# this is the list of everything that is ever added anywhere

tests/test_loaded.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ def test_fileobj(self):
5454
# clean up
5555
file_obj.close()
5656

57+
def test_load_bz2(self):
58+
mesh = g.trimesh.load(g.os.path.join(g.dir_models, "rock.obj.bz2"), force="mesh")
59+
assert mesh.is_volume
60+
5761

5862
if __name__ == "__main__":
5963
g.trimesh.util.attach_to_log()

tests/test_points.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def test_pointcloud(self):
6262

6363
# check to see if copy works
6464
assert g.np.allclose(cloud.vertices, cloud.copy().vertices)
65+
assert hash(cloud.visual) == hash(cloud.copy().visual)
6566

6667
def test_empty(self):
6768
p = g.trimesh.PointCloud(None)

tests/test_transformations.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ def test_quat(self):
178178
g.np.linalg.norm(random_quat(num=100), axis=1), 1.0, atol=1e-6
179179
)
180180

181+
def test_angle(self):
182+
assert g.np.isclose(
183+
g.trimesh.transformations.angle_between_vectors(g.np.ones(3), g.np.ones(3)),
184+
0.0,
185+
)
186+
181187

182188
if __name__ == "__main__":
183189
g.trimesh.util.attach_to_log()

trimesh/boolean.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ def boolean_manifold(meshes, operation, debug=False, **kwargs):
8383
"""
8484
# Convert to manifold meshes
8585
manifolds = [
86-
Manifold.from_mesh(
87-
Mesh(
86+
Manifold(
87+
mesh=Mesh(
8888
vert_properties=np.asarray(mesh.vertices, dtype="float32"),
8989
tri_verts=np.asarray(mesh.faces, dtype="int32"),
9090
)

trimesh/exchange/dae.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ def export_collada(mesh, **kwargs):
117117
uv = m.visual.uv
118118
elif m.visual.kind == "vertex":
119119
colors = (m.visual.vertex_colors / 255.0)[:, :3]
120+
mat.effect.diffuse = np.array(m.visual.main_color) / 255.0
121+
elif m.visual.kind == "face":
122+
mat.effect.diffuse = np.array(m.visual.main_color) / 255.0
120123
c.effects.append(mat.effect)
121124
c.materials.append(mat)
122125

0 commit comments

Comments
 (0)