conquer3d 0.7.9__tar.gz → 0.8.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {conquer3d-0.7.9/conquer3d.egg-info → conquer3d-0.8.2}/PKG-INFO +18 -35
- {conquer3d-0.7.9 → conquer3d-0.8.2}/README.md +17 -34
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/_C.pyi +45 -1
- conquer3d-0.8.2/conquer3d/_C.so +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/conversion/__init__.py +2 -4
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/creation/triangle_creation.cpp +5 -5
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/data_structure/bvh.cpp +50 -89
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/data_structure/grid.cpp +194 -188
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/data_structure/gs_bvh.cpp +57 -106
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/data_structure/kdtree.cpp +13 -23
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/data_structure/mesh_bvh.cpp +173 -260
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/data_structure/pgs_bvh.cpp +48 -81
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/data_structure/triangle_mesh.cpp +431 -384
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/data_structure/zcurve.cpp +3 -3
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/ops/chamfer.cpp +56 -73
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/ops/dc.cpp +46 -68
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/ops/dmc.cpp +37 -62
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/ops/flood_fill.cpp +12 -18
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/ops/flood_fill_cf.cpp +17 -31
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/ops/mc.cpp +50 -74
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/ops/mca.cpp +25 -42
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/ops/mt.cpp +51 -74
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/ops/mtg.cpp +52 -74
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/ops/volint.cpp +31 -55
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/primitive/gs.cpp +29 -54
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/primitive/pgs.cpp +13 -17
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/primitive/ray.cpp +36 -24
- conquer3d-0.8.2/conquer3d/csrc/binds/primitive/superquadric.cpp +133 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/binds/primitive/triangle.cpp +71 -72
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/check.h +5 -7
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/constants.h +8 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/creation/triangle_creation.h +28 -29
- conquer3d-0.8.2/conquer3d/csrc/data_structure/bvh.cu +650 -0
- conquer3d-0.8.2/conquer3d/csrc/data_structure/bvh.h +138 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/data_structure/bvh_traverse.cuh +13 -22
- conquer3d-0.8.2/conquer3d/csrc/data_structure/grid.cu +266 -0
- conquer3d-0.8.2/conquer3d/csrc/data_structure/grid.h +63 -0
- conquer3d-0.8.2/conquer3d/csrc/data_structure/gs_bvh.h +52 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/data_structure/kdtree.cu +106 -123
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/data_structure/kdtree.h +43 -63
- conquer3d-0.8.2/conquer3d/csrc/data_structure/mesh_bvh.cu +1034 -0
- conquer3d-0.8.2/conquer3d/csrc/data_structure/mesh_bvh.h +195 -0
- conquer3d-0.8.2/conquer3d/csrc/data_structure/pgs_bvh.h +44 -0
- conquer3d-0.8.2/conquer3d/csrc/data_structure/triangle_mesh.cu +1703 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/data_structure/triangle_mesh.h +146 -230
- conquer3d-0.8.2/conquer3d/csrc/data_structure/zcurve.cu +48 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/data_structure/zcurve.h +7 -7
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/maths/f2x2.h +33 -28
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/maths/f3x1.h +78 -62
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/maths/f3x3.h +57 -38
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/maths/f3x4.h +8 -12
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/maths/f4x1.h +46 -22
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/maths/f4x4.h +78 -46
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/maths/ops.h +20 -22
- conquer3d-0.8.2/conquer3d/csrc/maths/qef.h +247 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/ops/chamfer.cu +44 -95
- conquer3d-0.8.2/conquer3d/csrc/ops/chamfer.h +57 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/dc.cu +925 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/dc.h +47 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/dc_data.h +83 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/dmc.cu +1104 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/dmc.h +45 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/dmc_data.h +556 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/flood_fill.cu +213 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/flood_fill.h +42 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/flood_fill_cf.cu +960 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/flood_fill_cf.h +60 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/ops/flood_fill_common.cuh +38 -28
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/ops/mc.cu +268 -323
- conquer3d-0.8.2/conquer3d/csrc/ops/mc.h +73 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/mc_data.h +339 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/mca.cu +654 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/mca.h +61 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/mca_data.h +74 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/ops/mt.cu +292 -348
- conquer3d-0.8.2/conquer3d/csrc/ops/mt.h +65 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/mt_data.h +101 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/ops/mtg.cu +281 -317
- conquer3d-0.8.2/conquer3d/csrc/ops/mtg.h +66 -0
- conquer3d-0.8.2/conquer3d/csrc/ops/mtg_data.h +81 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/ops/volint.cu +48 -72
- conquer3d-0.8.2/conquer3d/csrc/ops/volint.h +38 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/ops/voxel_classify.cuh +28 -41
- conquer3d-0.8.2/conquer3d/csrc/primitive/aabb.h +185 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/primitive/edge.h +12 -11
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/primitive/gs.cu +23 -55
- conquer3d-0.8.2/conquer3d/csrc/primitive/gs.h +86 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/primitive/gs_aabb.cu +242 -511
- conquer3d-0.8.2/conquer3d/csrc/primitive/gs_math.cuh +220 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/primitive/pgs.cu +26 -43
- conquer3d-0.8.2/conquer3d/csrc/primitive/pgs.h +56 -0
- conquer3d-0.8.2/conquer3d/csrc/primitive/pgs_aabb.cu +408 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/primitive/pgs_math.cuh +43 -53
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/primitive/ray.h +21 -20
- conquer3d-0.8.2/conquer3d/csrc/primitive/superquadric.cu +422 -0
- conquer3d-0.8.2/conquer3d/csrc/primitive/superquadric.h +63 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/primitive/triangle.h +211 -119
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/pybind.cpp +33 -26
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/__init__.py +3 -5
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/assets/common.py +24 -72
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data_structure/__init__.py +3 -8
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/io/__init__.py +2 -4
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/__init__.py +3 -8
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/distance.py +7 -12
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/dpsr.py +2 -7
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/dual_contouring.py +3 -9
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/dual_marching_cubes.py +5 -9
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/hermite.py +12 -22
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/marching_cubes_asymptotic.py +6 -9
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/primitive/__init__.py +3 -7
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/primitive/sq.py +105 -53
- {conquer3d-0.7.9 → conquer3d-0.8.2/conquer3d.egg-info}/PKG-INFO +18 -35
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d.egg-info/SOURCES.txt +3 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/pyproject.toml +1 -1
- conquer3d-0.7.9/conquer3d/_C.so +0 -0
- conquer3d-0.7.9/conquer3d/csrc/data_structure/bvh.cu +0 -781
- conquer3d-0.7.9/conquer3d/csrc/data_structure/bvh.h +0 -174
- conquer3d-0.7.9/conquer3d/csrc/data_structure/grid.cu +0 -308
- conquer3d-0.7.9/conquer3d/csrc/data_structure/grid.h +0 -78
- conquer3d-0.7.9/conquer3d/csrc/data_structure/gs_bvh.h +0 -66
- conquer3d-0.7.9/conquer3d/csrc/data_structure/mesh_bvh.cu +0 -1194
- conquer3d-0.7.9/conquer3d/csrc/data_structure/mesh_bvh.h +0 -275
- conquer3d-0.7.9/conquer3d/csrc/data_structure/pgs_bvh.h +0 -54
- conquer3d-0.7.9/conquer3d/csrc/data_structure/triangle_mesh.cu +0 -1856
- conquer3d-0.7.9/conquer3d/csrc/data_structure/zcurve.cu +0 -48
- conquer3d-0.7.9/conquer3d/csrc/maths/qef.h +0 -243
- conquer3d-0.7.9/conquer3d/csrc/ops/chamfer.h +0 -67
- conquer3d-0.7.9/conquer3d/csrc/ops/dc.cu +0 -972
- conquer3d-0.7.9/conquer3d/csrc/ops/dc.h +0 -55
- conquer3d-0.7.9/conquer3d/csrc/ops/dc_data.h +0 -88
- conquer3d-0.7.9/conquer3d/csrc/ops/dmc.cu +0 -1072
- conquer3d-0.7.9/conquer3d/csrc/ops/dmc.h +0 -54
- conquer3d-0.7.9/conquer3d/csrc/ops/dmc_data.h +0 -653
- conquer3d-0.7.9/conquer3d/csrc/ops/flood_fill.cu +0 -256
- conquer3d-0.7.9/conquer3d/csrc/ops/flood_fill.h +0 -48
- conquer3d-0.7.9/conquer3d/csrc/ops/flood_fill_cf.cu +0 -994
- conquer3d-0.7.9/conquer3d/csrc/ops/flood_fill_cf.h +0 -63
- conquer3d-0.7.9/conquer3d/csrc/ops/mc.h +0 -86
- conquer3d-0.7.9/conquer3d/csrc/ops/mc_data.h +0 -360
- conquer3d-0.7.9/conquer3d/csrc/ops/mca.cu +0 -681
- conquer3d-0.7.9/conquer3d/csrc/ops/mca.h +0 -68
- conquer3d-0.7.9/conquer3d/csrc/ops/mca_data.h +0 -82
- conquer3d-0.7.9/conquer3d/csrc/ops/mt.h +0 -78
- conquer3d-0.7.9/conquer3d/csrc/ops/mt_data.h +0 -105
- conquer3d-0.7.9/conquer3d/csrc/ops/mtg.h +0 -79
- conquer3d-0.7.9/conquer3d/csrc/ops/mtg_data.h +0 -89
- conquer3d-0.7.9/conquer3d/csrc/ops/volint.h +0 -49
- conquer3d-0.7.9/conquer3d/csrc/primitive/aabb.h +0 -230
- conquer3d-0.7.9/conquer3d/csrc/primitive/gs.h +0 -135
- conquer3d-0.7.9/conquer3d/csrc/primitive/gs_math.cuh +0 -248
- conquer3d-0.7.9/conquer3d/csrc/primitive/pgs.h +0 -86
- conquer3d-0.7.9/conquer3d/csrc/primitive/pgs_aabb.cu +0 -524
- {conquer3d-0.7.9 → conquer3d-0.8.2}/LICENSE +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/MANIFEST.in +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/__init__.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/conversion/grid.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/conversion/mesh.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/conversion/tmesh.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/creation/__init__.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/creation/triangle_creation.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/csrc/maths/maths.h +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/assets/__init__.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/assets/iphigenia.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/collate/__init__.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/collate/mesh.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/collate/sparse_tensor.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/dataset/__init__.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/dataset/base_mesh.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/dataset/digit3d.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/dataset/digit3dmv.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/dataset/mesh.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/dataset/redwood.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/transform/__init__.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/transform/base.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/transform/ops.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data/transform/vertex.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data_structure/bmesh.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data_structure/grid.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/data_structure/sort.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/io/obj.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/io/off.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/io/ply.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/delaunay_triangulation.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/diff_marching_cubes.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/diff_marching_tetrahedra_grid.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/marching_cubes.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/marching_tetrahedra.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/marching_tetrahedra_grid.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/ops/volint.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/primitive/gs.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d/primitive/pgs.py +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d.egg-info/dependency_links.txt +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d.egg-info/not-zip-safe +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d.egg-info/requires.txt +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/conquer3d.egg-info/top_level.txt +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/setup.cfg +0 -0
- {conquer3d-0.7.9 → conquer3d-0.8.2}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: conquer3d
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.2
|
|
4
4
|
Summary: Geometric Cuda Tool Box
|
|
5
5
|
Author-email: Do Hoang Khoi <khoido8899@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -96,58 +96,41 @@ verts.sum().backward() # gradients flow back into the field
|
|
|
96
96
|
|
|
97
97
|
## 🔬 Qualitative Results
|
|
98
98
|
|
|
99
|
-
Every figure below is real library output on the bundled benchmark assets, regenerated
|
|
100
|
-
by `docs/_figures/make_figures.py` — nothing is mocked or hand-drawn. More, at full size,
|
|
101
|
-
on the **[showcase](https://khoidoo.github.io/conquer3d/)**.
|
|
102
|
-
|
|
103
99
|
### Isosurface extraction
|
|
104
100
|
|
|
105
|
-
<img src="docs/assets/img/fig-algorithms.webp" alt="
|
|
101
|
+
<img src="docs/assets/img/fig-algorithms.webp" alt="Isosurface extraction" width="100%">
|
|
106
102
|
|
|
107
|
-
One signed distance field
|
|
108
|
-
extractors — Marching Cubes, MC Asymptotic, Dual Contouring and Dual Marching Cubes —
|
|
109
|
-
with the source mesh on the left. The lower row crops the crease where Marching Cubes
|
|
110
|
-
and Dual Contouring disagree most.
|
|
103
|
+
One signed distance field meshed by four different extractors.
|
|
111
104
|
|
|
112
|
-
### Sharp features
|
|
105
|
+
### Sharp features
|
|
113
106
|
|
|
114
|
-
<img src="docs/assets/img/fig-hermite.webp" alt="
|
|
107
|
+
<img src="docs/assets/img/fig-hermite.webp" alt="Sharp features" width="100%">
|
|
115
108
|
|
|
116
|
-
|
|
117
|
-
from the grid, once with exact Hermite data from `compute_hermite_from_mesh`, which
|
|
118
|
-
ray-casts all 25,832 sign-crossing edges for the true intersection and face normal.
|
|
119
|
-
The crease is reconstructed rather than rounded.
|
|
109
|
+
Exact Hermite data lets the dual methods reconstruct a crease instead of rounding it.
|
|
120
110
|
|
|
121
|
-
###
|
|
111
|
+
### Grid resolution
|
|
122
112
|
|
|
123
|
-
<img src="docs/assets/img/fig-resolution.webp" alt="
|
|
113
|
+
<img src="docs/assets/img/fig-resolution.webp" alt="Grid resolution" width="100%">
|
|
124
114
|
|
|
125
|
-
|
|
126
|
-
Face count runs from 12,076 to 13,294,500, with Chamfer and Hausdorff distance to the
|
|
127
|
-
source measured at every step.
|
|
115
|
+
The same model extracted from 64³ up to 2048³, with the error measured at each step.
|
|
128
116
|
|
|
129
|
-
###
|
|
117
|
+
### Extraction pipeline
|
|
130
118
|
|
|
131
|
-
<img src="docs/assets/img/fig-pipeline.webp" alt="
|
|
119
|
+
<img src="docs/assets/img/fig-pipeline.webp" alt="Extraction pipeline" width="100%">
|
|
132
120
|
|
|
133
|
-
|
|
134
|
-
at 40³), the signed distance shown as a cutaway, the 2,646 bipolar cells, and the
|
|
135
|
-
extracted surface. No dense volume is ever held.
|
|
121
|
+
Every stage of one extraction, from input mesh to extracted surface.
|
|
136
122
|
|
|
137
|
-
###
|
|
123
|
+
### Sign modes
|
|
138
124
|
|
|
139
|
-
<img src="docs/assets/img/fig-sign-modes.webp" alt="
|
|
125
|
+
<img src="docs/assets/img/fig-sign-modes.webp" alt="Sign modes" width="100%">
|
|
140
126
|
|
|
141
|
-
One
|
|
142
|
-
pseudonormal, winding number, flood fill, hybrid consensus, and coarse-fine fill.
|
|
127
|
+
One slice through a mesh, signed by each of the six ways of deciding inside.
|
|
143
128
|
|
|
144
|
-
### Ray queries
|
|
129
|
+
### Ray queries
|
|
145
130
|
|
|
146
|
-
<img src="docs/assets/img/fig-meshbvh.webp" alt="Ray
|
|
131
|
+
<img src="docs/assets/img/fig-meshbvh.webp" alt="Ray queries" width="100%">
|
|
147
132
|
|
|
148
|
-
|
|
149
|
-
returns the narrow-band cells it crosses. Five rays from five origins, each drawn as far
|
|
150
|
-
as its own first hit.
|
|
133
|
+
Which triangles and which voxels a ray hits, found through the BVH.
|
|
151
134
|
|
|
152
135
|
---
|
|
153
136
|
|
|
@@ -63,58 +63,41 @@ verts.sum().backward() # gradients flow back into the field
|
|
|
63
63
|
|
|
64
64
|
## 🔬 Qualitative Results
|
|
65
65
|
|
|
66
|
-
Every figure below is real library output on the bundled benchmark assets, regenerated
|
|
67
|
-
by `docs/_figures/make_figures.py` — nothing is mocked or hand-drawn. More, at full size,
|
|
68
|
-
on the **[showcase](https://khoidoo.github.io/conquer3d/)**.
|
|
69
|
-
|
|
70
66
|
### Isosurface extraction
|
|
71
67
|
|
|
72
|
-
<img src="docs/assets/img/fig-algorithms.webp" alt="
|
|
68
|
+
<img src="docs/assets/img/fig-algorithms.webp" alt="Isosurface extraction" width="100%">
|
|
73
69
|
|
|
74
|
-
One signed distance field
|
|
75
|
-
extractors — Marching Cubes, MC Asymptotic, Dual Contouring and Dual Marching Cubes —
|
|
76
|
-
with the source mesh on the left. The lower row crops the crease where Marching Cubes
|
|
77
|
-
and Dual Contouring disagree most.
|
|
70
|
+
One signed distance field meshed by four different extractors.
|
|
78
71
|
|
|
79
|
-
### Sharp features
|
|
72
|
+
### Sharp features
|
|
80
73
|
|
|
81
|
-
<img src="docs/assets/img/fig-hermite.webp" alt="
|
|
74
|
+
<img src="docs/assets/img/fig-hermite.webp" alt="Sharp features" width="100%">
|
|
82
75
|
|
|
83
|
-
|
|
84
|
-
from the grid, once with exact Hermite data from `compute_hermite_from_mesh`, which
|
|
85
|
-
ray-casts all 25,832 sign-crossing edges for the true intersection and face normal.
|
|
86
|
-
The crease is reconstructed rather than rounded.
|
|
76
|
+
Exact Hermite data lets the dual methods reconstruct a crease instead of rounding it.
|
|
87
77
|
|
|
88
|
-
###
|
|
78
|
+
### Grid resolution
|
|
89
79
|
|
|
90
|
-
<img src="docs/assets/img/fig-resolution.webp" alt="
|
|
80
|
+
<img src="docs/assets/img/fig-resolution.webp" alt="Grid resolution" width="100%">
|
|
91
81
|
|
|
92
|
-
|
|
93
|
-
Face count runs from 12,076 to 13,294,500, with Chamfer and Hausdorff distance to the
|
|
94
|
-
source measured at every step.
|
|
82
|
+
The same model extracted from 64³ up to 2048³, with the error measured at each step.
|
|
95
83
|
|
|
96
|
-
###
|
|
84
|
+
### Extraction pipeline
|
|
97
85
|
|
|
98
|
-
<img src="docs/assets/img/fig-pipeline.webp" alt="
|
|
86
|
+
<img src="docs/assets/img/fig-pipeline.webp" alt="Extraction pipeline" width="100%">
|
|
99
87
|
|
|
100
|
-
|
|
101
|
-
at 40³), the signed distance shown as a cutaway, the 2,646 bipolar cells, and the
|
|
102
|
-
extracted surface. No dense volume is ever held.
|
|
88
|
+
Every stage of one extraction, from input mesh to extracted surface.
|
|
103
89
|
|
|
104
|
-
###
|
|
90
|
+
### Sign modes
|
|
105
91
|
|
|
106
|
-
<img src="docs/assets/img/fig-sign-modes.webp" alt="
|
|
92
|
+
<img src="docs/assets/img/fig-sign-modes.webp" alt="Sign modes" width="100%">
|
|
107
93
|
|
|
108
|
-
One
|
|
109
|
-
pseudonormal, winding number, flood fill, hybrid consensus, and coarse-fine fill.
|
|
94
|
+
One slice through a mesh, signed by each of the six ways of deciding inside.
|
|
110
95
|
|
|
111
|
-
### Ray queries
|
|
96
|
+
### Ray queries
|
|
112
97
|
|
|
113
|
-
<img src="docs/assets/img/fig-meshbvh.webp" alt="Ray
|
|
98
|
+
<img src="docs/assets/img/fig-meshbvh.webp" alt="Ray queries" width="100%">
|
|
114
99
|
|
|
115
|
-
|
|
116
|
-
returns the narrow-band cells it crosses. Five rays from five origins, each drawn as far
|
|
117
|
-
as its own first hit.
|
|
100
|
+
Which triangles and which voxels a ray hits, found through the BVH.
|
|
118
101
|
|
|
119
102
|
---
|
|
120
103
|
|
|
@@ -4,7 +4,7 @@ Conquer3D Python bindings
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
import torch
|
|
6
6
|
import typing
|
|
7
|
-
__all__: list[str] = ['BVH', 'GSBVH', 'KDTree', 'MeshBVH', 'PGSBVH', 'Ray', 'Triangle', 'TriangleMesh', 'build_sparse_grid_from_active_voxels', 'compute_active_voxels', 'compute_flood_fill', 'compute_flood_fill_cf', 'compute_grid_normal', 'compute_gs_aabb_func', 'compute_gs_covi_func', 'compute_zcurve', 'create_sphere', 'create_tetrahedra', 'create_voxel_cloud_from_tmesh', 'create_voxel_grid', 'create_voxel_grid_from_tmesh', 'dual_contouring', 'dual_contouring_backward', 'dual_marching_cubes', 'dual_marching_cubes_backward', 'get_active_voxel_ids_from_depth', 'marching_cubes', 'marching_cubes_asymptotic', 'marching_cubes_asymptotic_backward', 'marching_cubes_backward', 'marching_tetrahedra', 'marching_tetrahedra_backward', 'marching_tetrahedra_grid', 'marching_tetrahedra_grid_backward', 'one_sided_chamfer_distance', 'one_sided_chamfer_distance_backward', 'single_view_volume_integral', 'solve_gs_neighbor_mahalanobis_radius_func', 'solve_pgs_cluster_tangency_radius_func']
|
|
7
|
+
__all__: list[str] = ['BVH', 'GSBVH', 'KDTree', 'MeshBVH', 'PGSBVH', 'Ray', 'Triangle', 'TriangleMesh', 'build_sparse_grid_from_active_voxels', 'compute_active_voxels', 'compute_flood_fill', 'compute_flood_fill_cf', 'compute_grid_normal', 'compute_gs_aabb_func', 'compute_gs_covi_func', 'compute_superquadric_mesh_func', 'compute_zcurve', 'create_sphere', 'create_tetrahedra', 'create_voxel_cloud_from_tmesh', 'create_voxel_grid', 'create_voxel_grid_from_tmesh', 'dual_contouring', 'dual_contouring_backward', 'dual_marching_cubes', 'dual_marching_cubes_backward', 'get_active_voxel_ids_from_depth', 'marching_cubes', 'marching_cubes_asymptotic', 'marching_cubes_asymptotic_backward', 'marching_cubes_backward', 'marching_tetrahedra', 'marching_tetrahedra_backward', 'marching_tetrahedra_grid', 'marching_tetrahedra_grid_backward', 'one_sided_chamfer_distance', 'one_sided_chamfer_distance_backward', 'single_view_volume_integral', 'solve_gs_neighbor_mahalanobis_radius_func', 'solve_pgs_cluster_tangency_radius_func']
|
|
8
8
|
class BVH:
|
|
9
9
|
"""
|
|
10
10
|
|
|
@@ -1450,6 +1450,50 @@ def compute_gs_covi_func(means: torch.Tensor, rotations: torch.Tensor, scales: t
|
|
|
1450
1450
|
>>> from conquer3d._C import compute_gs_covi_func
|
|
1451
1451
|
>>> covis = compute_gs_covi_func(means, rotations, scales, True, 1e-6, 0)
|
|
1452
1452
|
"""
|
|
1453
|
+
def compute_superquadric_mesh_func(scales: torch.Tensor, exponents: torch.Tensor, rotations: torch.Tensor, translations: torch.Tensor, resolution: int = 30, return_labels: bool = False) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
1454
|
+
"""
|
|
1455
|
+
Tessellates a set of superquadrics into a single triangle mesh (CUDA).
|
|
1456
|
+
|
|
1457
|
+
Each primitive is meshed analytically from Barr's parametric form on an
|
|
1458
|
+
`(resolution, resolution)` grid of angles spaced by approximately equal arc length,
|
|
1459
|
+
then rotated and translated into world space. The per-primitive meshes are packed
|
|
1460
|
+
into one vertex and triangle array by offsetting indices.
|
|
1461
|
+
|
|
1462
|
+
Args:
|
|
1463
|
+
scales (torch.Tensor): (K, 3) float32 semi-axes on CUDA, strictly positive.
|
|
1464
|
+
exponents (torch.Tensor): (K, 2) float32 shape exponents on CUDA.
|
|
1465
|
+
rotations (torch.Tensor): (K, 3, 3) float32 local-to-world rotations on CUDA.
|
|
1466
|
+
translations (torch.Tensor): (K, 3) float32 primitive centres on CUDA.
|
|
1467
|
+
resolution (int, optional): Angular samples along each axis. Each primitive
|
|
1468
|
+
contributes `resolution * (resolution - 2) + 2` vertices and
|
|
1469
|
+
`2 * resolution * (resolution - 2)` triangles. Defaults to 30.
|
|
1470
|
+
return_labels (bool, optional): If True, also returns the originating primitive
|
|
1471
|
+
index of every vertex. Defaults to False.
|
|
1472
|
+
|
|
1473
|
+
Returns:
|
|
1474
|
+
Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]:
|
|
1475
|
+
- vertices (torch.Tensor): (V, 3) float32 world coordinates.
|
|
1476
|
+
- triangles (torch.Tensor): (F, 3) int32 vertex indices.
|
|
1477
|
+
- labels (torch.Tensor): (V,) int32 primitive index per vertex, or None
|
|
1478
|
+
when `return_labels` is False.
|
|
1479
|
+
|
|
1480
|
+
Note:
|
|
1481
|
+
The result is a concatenation, not a union: it holds one closed surface per
|
|
1482
|
+
primitive, and wherever two primitives overlap their triangles pass through one
|
|
1483
|
+
another with no shared vertices. Each individual primitive is watertight with
|
|
1484
|
+
Euler characteristic 2.
|
|
1485
|
+
|
|
1486
|
+
Note:
|
|
1487
|
+
The surface is evaluated in float64 and narrowed on write. Near the poles a
|
|
1488
|
+
float32 angle perturbs the cosine by an order of magnitude, and the fractional
|
|
1489
|
+
power turns that into a visible displacement on exactly the sharp corners this
|
|
1490
|
+
tessellation exists to capture.
|
|
1491
|
+
|
|
1492
|
+
Example:
|
|
1493
|
+
>>> from conquer3d._C import compute_superquadric_mesh_func
|
|
1494
|
+
>>> verts, tris, _ = compute_superquadric_mesh_func(
|
|
1495
|
+
... scales, exponents, rotations, translations, 40)
|
|
1496
|
+
"""
|
|
1453
1497
|
def compute_zcurve(points: torch.Tensor) -> torch.Tensor:
|
|
1454
1498
|
"""
|
|
1455
1499
|
Computes 30-bit 3D Morton space-filling Z-curve codes for points in normalized [0, 1]^3.
|
|
Binary file
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"""Geometric format and volumetric conversion pipelines.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- Dense occupancy grids and sparse COO indices (`dense_occ2sparse_coo`, `sparse_coo2dense_occ`).
|
|
6
|
-
- Triangle meshes and dense/sparse voxel signed distance fields (`tmesh2voxel`, `tmesh2sparse`, `tmesh2voxelcloud`).
|
|
3
|
+
Bidirectional conversions between dense grids, sparse COO coordinates, occupancy volumes,
|
|
4
|
+
and the signed distance fields built from a triangle mesh.
|
|
7
5
|
"""
|
|
8
6
|
|
|
9
7
|
from .grid import (
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
namespace py = pybind11;
|
|
6
6
|
|
|
7
|
-
void bind_creation_triangle_creation(py::module_ &m)
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
void bind_creation_triangle_creation(py::module_ &m)
|
|
8
|
+
{
|
|
9
|
+
m.def("create_sphere", &triangle_creation::create_sphere, py::arg("sectors") = 32, py::arg("stacks") = 16,
|
|
10
|
+
py::arg("radius") = 1.0f,
|
|
10
11
|
R"pbdoc(
|
|
11
12
|
Generates a parameterized UV sphere mesh on CPU.
|
|
12
13
|
|
|
@@ -25,8 +26,7 @@ void bind_creation_triangle_creation(py::module_ &m) {
|
|
|
25
26
|
>>> from conquer3d._C import create_sphere
|
|
26
27
|
>>> verts, tris = create_sphere(sectors=32, stacks=16, radius=1.0)
|
|
27
28
|
)pbdoc");
|
|
28
|
-
m.def("create_tetrahedra", &triangle_creation::create_tetrahedra,
|
|
29
|
-
py::arg("radius") = 1.0f,
|
|
29
|
+
m.def("create_tetrahedra", &triangle_creation::create_tetrahedra, py::arg("radius") = 1.0f,
|
|
30
30
|
R"pbdoc(
|
|
31
31
|
Generates a regular 4-faced tetrahedron mesh inscribed in a sphere of given radius on CPU.
|
|
32
32
|
|
|
@@ -8,9 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
namespace py = pybind11;
|
|
10
10
|
|
|
11
|
-
BVH::BVH(
|
|
12
|
-
const torch::Tensor &in_aabb_mins,
|
|
13
|
-
const torch::Tensor &in_aabb_maxs)
|
|
11
|
+
BVH::BVH(const torch::Tensor &in_aabb_mins, const torch::Tensor &in_aabb_maxs)
|
|
14
12
|
{
|
|
15
13
|
CHECK_INPUT(in_aabb_mins);
|
|
16
14
|
CHECK_INPUT(in_aabb_maxs);
|
|
@@ -57,21 +55,17 @@ BVH::BVH(
|
|
|
57
55
|
this->bvh_parents = torch::empty({this->num_nodes}, options.dtype(torch::kInt32));
|
|
58
56
|
this->object_ids = torch::empty({this->num_objects}, options.dtype(torch::kInt32));
|
|
59
57
|
|
|
60
|
-
bvh::build(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
reinterpret_cast<int2 *>(this->bvh_children.data_ptr<int>()),
|
|
68
|
-
reinterpret_cast<int *>(this->bvh_parents.data_ptr<int>()),
|
|
69
|
-
reinterpret_cast<int *>(this->object_ids.data_ptr<int>()));
|
|
58
|
+
bvh::build(this->num_objects, this->num_nodes, reinterpret_cast<const float3 *>(in_aabb_mins.data_ptr<float>()),
|
|
59
|
+
reinterpret_cast<const float3 *>(in_aabb_maxs.data_ptr<float>()),
|
|
60
|
+
reinterpret_cast<float3 *>(this->aabb_mins.data_ptr<float>()),
|
|
61
|
+
reinterpret_cast<float3 *>(this->aabb_maxs.data_ptr<float>()),
|
|
62
|
+
reinterpret_cast<int2 *>(this->bvh_children.data_ptr<int>()),
|
|
63
|
+
reinterpret_cast<int *>(this->bvh_parents.data_ptr<int>()),
|
|
64
|
+
reinterpret_cast<int *>(this->object_ids.data_ptr<int>()));
|
|
70
65
|
}
|
|
71
66
|
|
|
72
|
-
std::tuple<torch::Tensor, torch::Tensor> BVH::query(
|
|
73
|
-
|
|
74
|
-
const torch::Tensor &query_aabb_maxs)
|
|
67
|
+
std::tuple<torch::Tensor, torch::Tensor> BVH::query(const torch::Tensor &query_aabb_mins,
|
|
68
|
+
const torch::Tensor &query_aabb_maxs)
|
|
75
69
|
{
|
|
76
70
|
CHECK_INPUT(query_aabb_mins);
|
|
77
71
|
CHECK_INPUT(query_aabb_maxs);
|
|
@@ -94,27 +88,21 @@ std::tuple<torch::Tensor, torch::Tensor> BVH::query(
|
|
|
94
88
|
|
|
95
89
|
torch::Tensor hit_counter = torch::zeros({1}, options_int64);
|
|
96
90
|
|
|
97
|
-
bvh::query(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
reinterpret_cast<int64_t *>(out_query_ids.data_ptr<int64_t>()),
|
|
107
|
-
reinterpret_cast<int64_t *>(out_object_ids.data_ptr<int64_t>()),
|
|
108
|
-
reinterpret_cast<int64_t *>(hit_counter.data_ptr<int64_t>()),
|
|
109
|
-
static_cast<int64_t>(BVH_MAX_CAPACITY));
|
|
91
|
+
bvh::query(num_queries, this->num_objects, reinterpret_cast<const float3 *>(query_aabb_mins.data_ptr<float>()),
|
|
92
|
+
reinterpret_cast<const float3 *>(query_aabb_maxs.data_ptr<float>()),
|
|
93
|
+
reinterpret_cast<const float3 *>(this->aabb_mins.data_ptr<float>()),
|
|
94
|
+
reinterpret_cast<const float3 *>(this->aabb_maxs.data_ptr<float>()),
|
|
95
|
+
reinterpret_cast<const int2 *>(this->bvh_children.data_ptr<int>()),
|
|
96
|
+
reinterpret_cast<const int *>(this->object_ids.data_ptr<int>()),
|
|
97
|
+
reinterpret_cast<int64_t *>(out_query_ids.data_ptr<int64_t>()),
|
|
98
|
+
reinterpret_cast<int64_t *>(out_object_ids.data_ptr<int64_t>()),
|
|
99
|
+
reinterpret_cast<int64_t *>(hit_counter.data_ptr<int64_t>()), static_cast<int64_t>(BVH_MAX_CAPACITY));
|
|
110
100
|
|
|
111
101
|
int64_t num_hits = hit_counter.item<int64_t>();
|
|
112
102
|
|
|
113
103
|
num_hits = std::min(num_hits, static_cast<int64_t>(BVH_MAX_CAPACITY));
|
|
114
104
|
|
|
115
|
-
return std::make_tuple(
|
|
116
|
-
out_query_ids.slice(0, 0, num_hits),
|
|
117
|
-
out_object_ids.slice(0, 0, num_hits));
|
|
105
|
+
return std::make_tuple(out_query_ids.slice(0, 0, num_hits), out_object_ids.slice(0, 0, num_hits));
|
|
118
106
|
}
|
|
119
107
|
|
|
120
108
|
std::tuple<torch::Tensor, torch::Tensor> BVH::query_self()
|
|
@@ -130,29 +118,23 @@ std::tuple<torch::Tensor, torch::Tensor> BVH::query_self()
|
|
|
130
118
|
torch::Tensor out_object_ids = torch::empty({BVH_MAX_CAPACITY}, options_int64);
|
|
131
119
|
torch::Tensor hit_counter = torch::zeros({1}, options_int64);
|
|
132
120
|
|
|
133
|
-
bvh::query_self(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
reinterpret_cast<int64_t *>(hit_counter.data_ptr<int64_t>()),
|
|
142
|
-
static_cast<int64_t>(BVH_MAX_CAPACITY));
|
|
121
|
+
bvh::query_self(this->num_objects, reinterpret_cast<const float3 *>(this->aabb_mins.data_ptr<float>()),
|
|
122
|
+
reinterpret_cast<const float3 *>(this->aabb_maxs.data_ptr<float>()),
|
|
123
|
+
reinterpret_cast<const int2 *>(this->bvh_children.data_ptr<int>()),
|
|
124
|
+
reinterpret_cast<const int *>(this->object_ids.data_ptr<int>()),
|
|
125
|
+
reinterpret_cast<int64_t *>(out_query_ids.data_ptr<int64_t>()),
|
|
126
|
+
reinterpret_cast<int64_t *>(out_object_ids.data_ptr<int64_t>()),
|
|
127
|
+
reinterpret_cast<int64_t *>(hit_counter.data_ptr<int64_t>()),
|
|
128
|
+
static_cast<int64_t>(BVH_MAX_CAPACITY));
|
|
143
129
|
|
|
144
130
|
int64_t num_hits = hit_counter.item<int64_t>();
|
|
145
131
|
num_hits = std::min(num_hits, static_cast<int64_t>(BVH_MAX_CAPACITY));
|
|
146
132
|
|
|
147
|
-
return std::make_tuple(
|
|
148
|
-
out_query_ids.slice(0, 0, num_hits),
|
|
149
|
-
out_object_ids.slice(0, 0, num_hits));
|
|
133
|
+
return std::make_tuple(out_query_ids.slice(0, 0, num_hits), out_object_ids.slice(0, 0, num_hits));
|
|
150
134
|
}
|
|
151
135
|
|
|
152
|
-
std::tuple<torch::Tensor, torch::Tensor> BVH::query_ray(
|
|
153
|
-
|
|
154
|
-
const torch::Tensor &ray_dirs,
|
|
155
|
-
int64_t max_capacity)
|
|
136
|
+
std::tuple<torch::Tensor, torch::Tensor> BVH::query_ray(const torch::Tensor &ray_origins, const torch::Tensor &ray_dirs,
|
|
137
|
+
int64_t max_capacity)
|
|
156
138
|
{
|
|
157
139
|
CHECK_INPUT(ray_origins);
|
|
158
140
|
CHECK_INPUT(ray_dirs);
|
|
@@ -165,19 +147,11 @@ std::tuple<torch::Tensor, torch::Tensor> BVH::query_ray(
|
|
|
165
147
|
torch::Tensor out_object_ids = torch::empty({max_capacity}, options_i64);
|
|
166
148
|
torch::Tensor hit_counter = torch::zeros({1}, options_i64);
|
|
167
149
|
|
|
168
|
-
bvh::query_ray(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
(const float3 *)this->aabb_mins.data_ptr<float>(),
|
|
174
|
-
(const float3 *)this->aabb_maxs.data_ptr<float>(),
|
|
175
|
-
(const int2 *)this->bvh_children.data_ptr<int>(),
|
|
176
|
-
this->object_ids.data_ptr<int>(),
|
|
177
|
-
out_query_ids.data_ptr<int64_t>(),
|
|
178
|
-
out_object_ids.data_ptr<int64_t>(),
|
|
179
|
-
hit_counter.data_ptr<int64_t>(),
|
|
180
|
-
max_capacity);
|
|
150
|
+
bvh::query_ray(num_queries, this->num_objects, (const float3 *)ray_origins.data_ptr<float>(),
|
|
151
|
+
(const float3 *)ray_dirs.data_ptr<float>(), (const float3 *)this->aabb_mins.data_ptr<float>(),
|
|
152
|
+
(const float3 *)this->aabb_maxs.data_ptr<float>(), (const int2 *)this->bvh_children.data_ptr<int>(),
|
|
153
|
+
this->object_ids.data_ptr<int>(), out_query_ids.data_ptr<int64_t>(),
|
|
154
|
+
out_object_ids.data_ptr<int64_t>(), hit_counter.data_ptr<int64_t>(), max_capacity);
|
|
181
155
|
|
|
182
156
|
int64_t h_hit_counter = hit_counter.item<int64_t>();
|
|
183
157
|
|
|
@@ -189,18 +163,13 @@ std::tuple<torch::Tensor, torch::Tensor> BVH::query_ray(
|
|
|
189
163
|
|
|
190
164
|
if (h_hit_counter == 0)
|
|
191
165
|
{
|
|
192
|
-
return std::make_tuple(
|
|
193
|
-
torch::empty({0}, options_i64),
|
|
194
|
-
torch::empty({0}, options_i64));
|
|
166
|
+
return std::make_tuple(torch::empty({0}, options_i64), torch::empty({0}, options_i64));
|
|
195
167
|
}
|
|
196
168
|
|
|
197
|
-
return std::make_tuple(
|
|
198
|
-
out_query_ids.slice(0, 0, h_hit_counter),
|
|
199
|
-
out_object_ids.slice(0, 0, h_hit_counter));
|
|
169
|
+
return std::make_tuple(out_query_ids.slice(0, 0, h_hit_counter), out_object_ids.slice(0, 0, h_hit_counter));
|
|
200
170
|
}
|
|
201
171
|
|
|
202
|
-
std::tuple<torch::Tensor, torch::Tensor, torch::Tensor> BVH::query_point(
|
|
203
|
-
const torch::Tensor &query_points)
|
|
172
|
+
std::tuple<torch::Tensor, torch::Tensor, torch::Tensor> BVH::query_point(const torch::Tensor &query_points)
|
|
204
173
|
{
|
|
205
174
|
CHECK_INPUT(query_points);
|
|
206
175
|
|
|
@@ -214,21 +183,16 @@ std::tuple<torch::Tensor, torch::Tensor, torch::Tensor> BVH::query_point(
|
|
|
214
183
|
torch::Tensor out_distances = torch::empty({num_queries}, options_f32);
|
|
215
184
|
|
|
216
185
|
bvh::query_point(
|
|
217
|
-
num_queries,
|
|
218
|
-
this->
|
|
219
|
-
(const
|
|
220
|
-
(
|
|
221
|
-
(const float3 *)this->aabb_maxs.data_ptr<float>(),
|
|
222
|
-
(const int2 *)this->bvh_children.data_ptr<int>(),
|
|
223
|
-
this->object_ids.data_ptr<int>(),
|
|
224
|
-
out_query_ids.data_ptr<int64_t>(),
|
|
225
|
-
out_object_ids.data_ptr<int64_t>(),
|
|
226
|
-
out_distances.data_ptr<float>());
|
|
186
|
+
num_queries, this->num_objects, (const float3 *)query_points.data_ptr<float>(),
|
|
187
|
+
(const float3 *)this->aabb_mins.data_ptr<float>(), (const float3 *)this->aabb_maxs.data_ptr<float>(),
|
|
188
|
+
(const int2 *)this->bvh_children.data_ptr<int>(), this->object_ids.data_ptr<int>(),
|
|
189
|
+
out_query_ids.data_ptr<int64_t>(), out_object_ids.data_ptr<int64_t>(), out_distances.data_ptr<float>());
|
|
227
190
|
|
|
228
191
|
return std::make_tuple(out_query_ids, out_object_ids, out_distances);
|
|
229
192
|
}
|
|
230
193
|
|
|
231
|
-
void bind_ds_bvh(py::module_ &m)
|
|
194
|
+
void bind_ds_bvh(py::module_ &m)
|
|
195
|
+
{
|
|
232
196
|
py::class_<BVH>(m, "BVH", R"pbdoc(
|
|
233
197
|
GPU-accelerated Linear Bounding Volume Hierarchy (LBVH) built using Karras (2012) Radix LBVH algorithm.
|
|
234
198
|
|
|
@@ -238,8 +202,7 @@ void bind_ds_bvh(py::module_ &m) {
|
|
|
238
202
|
>>> bvh = BVH(aabb_mins, aabb_maxs)
|
|
239
203
|
>>> query_ids, obj_ids = bvh.query(query_mins, query_maxs)
|
|
240
204
|
)pbdoc")
|
|
241
|
-
.def(py::init<const torch::Tensor &, const torch::Tensor &>(),
|
|
242
|
-
py::arg("in_aabb_mins"), py::arg("in_aabb_maxs"),
|
|
205
|
+
.def(py::init<const torch::Tensor &, const torch::Tensor &>(), py::arg("in_aabb_mins"), py::arg("in_aabb_maxs"),
|
|
243
206
|
R"pbdoc(
|
|
244
207
|
Constructs and builds the GPU BVH from primitive AABBs.
|
|
245
208
|
|
|
@@ -250,8 +213,7 @@ void bind_ds_bvh(py::module_ &m) {
|
|
|
250
213
|
Example:
|
|
251
214
|
>>> bvh = BVH(aabb_mins, aabb_maxs)
|
|
252
215
|
)pbdoc")
|
|
253
|
-
.def("query", &BVH::query,
|
|
254
|
-
py::arg("query_aabb_mins"), py::arg("query_aabb_maxs"),
|
|
216
|
+
.def("query", &BVH::query, py::arg("query_aabb_mins"), py::arg("query_aabb_maxs"),
|
|
255
217
|
R"pbdoc(
|
|
256
218
|
Queries the BVH with bounding boxes for broad-phase collision.
|
|
257
219
|
|
|
@@ -279,8 +241,8 @@ void bind_ds_bvh(py::module_ &m) {
|
|
|
279
241
|
Example:
|
|
280
242
|
>>> q_ids, obj_ids = bvh.query_self()
|
|
281
243
|
)pbdoc")
|
|
282
|
-
.def("query_ray", &BVH::query_ray,
|
|
283
|
-
py::arg("
|
|
244
|
+
.def("query_ray", &BVH::query_ray, py::arg("ray_origins"), py::arg("ray_dirs"),
|
|
245
|
+
py::arg("max_capacity") = BVH_MAX_CAPACITY,
|
|
284
246
|
R"pbdoc(
|
|
285
247
|
Finds all ray-AABB intersections using fast Kay-Kajiya slab testing.
|
|
286
248
|
|
|
@@ -297,8 +259,7 @@ void bind_ds_bvh(py::module_ &m) {
|
|
|
297
259
|
Example:
|
|
298
260
|
>>> ray_ids, obj_ids = bvh.query_ray(origins, dirs)
|
|
299
261
|
)pbdoc")
|
|
300
|
-
.def("query_point", &BVH::query_point,
|
|
301
|
-
py::arg("query_points"),
|
|
262
|
+
.def("query_point", &BVH::query_point, py::arg("query_points"),
|
|
302
263
|
R"pbdoc(
|
|
303
264
|
Finds the closest leaf AABB and distance to each 3D query point.
|
|
304
265
|
|