Skip to content

Commit 0089839

Browse files
committed
✨ Add trimesh dependency and update STLInfo structures to include stl_path
1 parent a1149f6 commit 0089839

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

CondaPkg.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ channels = ["conda-forge", "anaconda"]
44
python = ">=3.12,<3.13"
55
numpy = ">=2.2"
66
shapely = ">=2.1"
7-
open3d = ">=0.19"
7+
open3d = ">=0.19"
8+
trimesh = ">=4.6"
9+
rtree = ">=1.4"
10+
scipy = ">=1.15"

src/FastPointQuery.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ using CondaPkg, PythonCall
55
const np = PythonCall.pynew()
66
const shapely = PythonCall.pynew()
77
const o3d = PythonCall.pynew()
8+
const trimesh = PythonCall.pynew()
9+
10+
const py2ju = PythonCall.pyconvert
11+
const pyfun = PythonCall.pybuiltins
812

913
function __init__()
1014
@info "initializing environment..."
1115
try # import Python modules
1216
PythonCall.pycopy!(np , PythonCall.pyimport("numpy" ))
1317
PythonCall.pycopy!(shapely, PythonCall.pyimport("shapely"))
1418
PythonCall.pycopy!(o3d , PythonCall.pyimport("open3d" ))
19+
PythonCall.pycopy!(trimesh, PythonCall.pyimport("trimesh"))
1520
catch e
1621
@error "Failed to initialize Python ENV" exception=e
1722
end
@@ -23,6 +28,7 @@ struct STLInfo2D
2328
vmax ::Vector
2429
py_vertices ::Py
2530
py_triangles::Py
31+
stl_path ::String
2632
end
2733

2834
struct STLInfo3D
@@ -31,6 +37,7 @@ struct STLInfo3D
3137
vmax ::Vector
3238
py_vertices ::Py
3339
py_triangles::Py
40+
stl_path ::String
3441
end
3542

3643
struct QueryPolygon

src/utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function readSTL2D(stl_file)
2727
aabb = mesh.get_axis_aligned_bounding_box()
2828
vmin = pyconvert(Vector, aabb.get_min_bound())
2929
vmax = pyconvert(Vector, aabb.get_max_bound())
30-
return STLInfo2D(mesh, vmin, vmax, vertices, triangles)
30+
return STLInfo2D(mesh, vmin, vmax, vertices, triangles, stl_file)
3131
end
3232

3333
"""
@@ -51,5 +51,5 @@ function readSTL3D(stl_file)
5151
aabb = mesh.get_axis_aligned_bounding_box()
5252
vmin = pyconvert(Vector, aabb.get_min_bound())
5353
vmax = pyconvert(Vector, aabb.get_max_bound())
54-
return STLInfo3D(mesh, vmin, vmax, vertices, triangles)
54+
return STLInfo3D(mesh, vmin, vmax, vertices, triangles, stl_file)
5555
end

test/runtests.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ using Test
44

55
@test !PythonCall.pyisnull(FastPointQuery.np )
66
@test !PythonCall.pyisnull(FastPointQuery.shapely)
7-
@test !PythonCall.pyisnull(FastPointQuery.o3d )
7+
@test !PythonCall.pyisnull(FastPointQuery.o3d )
8+
@test !PythonCall.pyisnull(FastPointQuery.trimesh)

0 commit comments

Comments
 (0)