Skip to content

Commit 2615cc5

Browse files
committed
✨ Add table of contents and include statement
1 parent 7a1c6c1 commit 2615cc5

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

src/discretization/_polyhedron.jl

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
# todo
1+
#==========================================================================================+
2+
| TABLE OF CONTENTS: |
3+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4+
| - _get_pts_voxel |
5+
+==========================================================================================#
6+
7+
function _get_pts_voxel(stl_model::STLInfo3D, h::Real; fill::Bool=true)
8+
# inputs check
9+
h > 0 || error("h must be a positive number")
10+
step = h * 0.25
11+
offsets = np.array([-1 1 1; -1 1 -1; 1 1 1; 1 1 -1
12+
-1 -1 1; -1 -1 -1; 1 -1 1; 1 -1 -1]) * step
13+
py_all = pyslice(nothing, nothing, nothing)
14+
15+
# convert to trimesh
16+
vertices = stl_model.py_vertices
17+
faces = stl_model.py_triangles
18+
mesh_trimesh = trimesh.Trimesh(vertices=vertices, faces=faces, process=false)
19+
20+
println("\e[1;36m[start]:\e[0m generating pts at h = $h")
21+
filled_vox = mesh_trimesh.voxelized(h).fill()
22+
pts_cen = filled_vox.points
23+
24+
if fill # filling mode
25+
expanded = pts_cen[py_all, np.newaxis, py_all] + offsets[np.newaxis, py_all, py_all]
26+
return PyArray(expanded.reshape(-1, 3))
27+
else
28+
return PyArray(pts_cen)
29+
end
30+
end

src/polyhedron.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
| - pip_query |
55
+==========================================================================================#
66

7+
include(joinpath(@__DIR__, "discretization/_polyhedron.jl"))
8+
79
function pip_query(
810
stl_model::STLInfo3D,
911
points ::AbstractMatrix;

0 commit comments

Comments
 (0)