conquer3d 0.2.0__tar.gz → 0.2.4__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.2.4/MANIFEST.in +1 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/PKG-INFO +7 -5
- {conquer3d-0.2.0 → conquer3d-0.2.4}/README.md +5 -3
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/_C.pyi +107 -1
- conquer3d-0.2.4/conquer3d/_C.so +0 -0
- conquer3d-0.2.4/conquer3d/__init__.py +8 -0
- conquer3d-0.2.4/conquer3d/creation/__init__.py +5 -0
- conquer3d-0.2.4/conquer3d/creation/triangle_creation.py +23 -0
- conquer3d-0.2.4/conquer3d/csrc/binds/creation/triangle_creation.cpp +13 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/binds/data_structure/bvh.cpp +38 -2
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/binds/data_structure/gs_bvh.cpp +1 -1
- conquer3d-0.2.4/conquer3d/csrc/binds/data_structure/mesh_bvh.cpp +22 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/binds/data_structure/pgs_bvh.cpp +1 -1
- conquer3d-0.2.4/conquer3d/csrc/binds/data_structure/triangle_mesh.cpp +338 -0
- conquer3d-0.2.4/conquer3d/csrc/check.h +29 -0
- conquer3d-0.2.4/conquer3d/csrc/constants.h +26 -0
- conquer3d-0.2.4/conquer3d/csrc/creation/triangle_creation.h +97 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/data_structure/bvh.cu +84 -0
- conquer3d-0.2.4/conquer3d/csrc/data_structure/bvh.h +74 -0
- conquer3d-0.2.4/conquer3d/csrc/data_structure/gs_bvh.h +49 -0
- conquer3d-0.2.4/conquer3d/csrc/data_structure/kdtree.h +118 -0
- conquer3d-0.2.4/conquer3d/csrc/data_structure/mesh_bvh.cu +98 -0
- conquer3d-0.2.4/conquer3d/csrc/data_structure/mesh_bvh.h +24 -0
- conquer3d-0.2.4/conquer3d/csrc/data_structure/pgs_bvh.h +40 -0
- conquer3d-0.2.4/conquer3d/csrc/data_structure/triangle_mesh.cu +397 -0
- conquer3d-0.2.4/conquer3d/csrc/data_structure/triangle_mesh.h +134 -0
- conquer3d-0.2.4/conquer3d/csrc/data_structure/zcurve.h +30 -0
- conquer3d-0.2.4/conquer3d/csrc/maths/f2x2.h +90 -0
- conquer3d-0.2.4/conquer3d/csrc/maths/f3x1.h +82 -0
- conquer3d-0.2.4/conquer3d/csrc/maths/f3x3.h +118 -0
- conquer3d-0.2.4/conquer3d/csrc/maths/f3x4.h +28 -0
- conquer3d-0.2.4/conquer3d/csrc/maths/f4x1.h +75 -0
- conquer3d-0.2.4/conquer3d/csrc/maths/f4x4.h +130 -0
- conquer3d-0.2.4/conquer3d/csrc/maths/maths.h +11 -0
- conquer3d-0.2.4/conquer3d/csrc/maths/ops.h +20 -0
- conquer3d-0.2.4/conquer3d/csrc/primitive/aabb.h +154 -0
- conquer3d-0.2.4/conquer3d/csrc/primitive/edge.h +31 -0
- conquer3d-0.2.4/conquer3d/csrc/primitive/gs.h +112 -0
- conquer3d-0.2.4/conquer3d/csrc/primitive/gs_math.cuh +204 -0
- conquer3d-0.2.4/conquer3d/csrc/primitive/pgs.h +71 -0
- conquer3d-0.2.4/conquer3d/csrc/primitive/pgs_math.cuh +100 -0
- conquer3d-0.2.4/conquer3d/csrc/primitive/triangles.h +106 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/pybind.cpp +7 -0
- conquer3d-0.2.4/conquer3d/data_structure/__init__.py +13 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d.egg-info/PKG-INFO +7 -5
- conquer3d-0.2.4/conquer3d.egg-info/SOURCES.txt +63 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/pyproject.toml +2 -2
- {conquer3d-0.2.0 → conquer3d-0.2.4}/setup.py +1 -1
- conquer3d-0.2.0/conquer3d/_C.so +0 -0
- conquer3d-0.2.0/conquer3d/__init__.py +0 -5
- conquer3d-0.2.0/conquer3d/data_structure/__init__.py +0 -8
- conquer3d-0.2.0/conquer3d.egg-info/SOURCES.txt +0 -30
- {conquer3d-0.2.0 → conquer3d-0.2.4}/LICENSE +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/binds/data_structure/kdtree.cpp +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/binds/primitive/gs.cpp +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/binds/primitive/pgs.cpp +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/data_structure/kdtree.cu +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/primitive/gs.cu +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/primitive/gs_aabb.cu +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/primitive/pgs.cu +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/csrc/primitive/pgs_aabb.cu +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/primitive/__init__.py +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/primitive/gs.py +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d/primitive/pgs.py +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d.egg-info/dependency_links.txt +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d.egg-info/not-zip-safe +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d.egg-info/requires.txt +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/conquer3d.egg-info/top_level.txt +0 -0
- {conquer3d-0.2.0 → conquer3d-0.2.4}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-include conquer3d/csrc *.h *.hpp *.cuh *.cpp *.cu
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: conquer3d
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Geometric Cuda Tool Box
|
|
5
5
|
Author-email: Do Hoang Khoi <khoido8899@gmail.com>
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/KhoiDOO/conquer3d
|
|
8
8
|
Project-URL: Repository, https://github.com/KhoiDOO/conquer3d.git
|
|
9
9
|
Project-URL: Documentation, https://github.com/KhoiDOO/conquer3d#readme
|
|
@@ -60,7 +60,7 @@ pip install plotly open3d jupyter trimesh
|
|
|
60
60
|
pip install build twine
|
|
61
61
|
rm -rf dist
|
|
62
62
|
python -m build --sdist
|
|
63
|
-
twine upload dist/*
|
|
63
|
+
twine upload dist/* --verbose
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
# Reference
|
|
@@ -90,5 +90,7 @@ series = {EGGH-HPG'12}
|
|
|
90
90
|
## Repository
|
|
91
91
|
- [cuBQL](https://github.com/NVIDIA/cuBQL)
|
|
92
92
|
- [cudaKDTree](https://github.com/ingowald/cudaKDTree)
|
|
93
|
-
- [Kaolin]
|
|
94
|
-
- [Pytorch3D]
|
|
93
|
+
- [Kaolin](https://github.com/NVIDIAGameWorks/kaolin)
|
|
94
|
+
- [Pytorch3D](https://github.com/facebookresearch/pytorch3d)
|
|
95
|
+
- [Open3D](https://www.open3d.org/)
|
|
96
|
+
- [trimesh](https://github.com/mikedh/trimesh)
|
|
@@ -36,7 +36,7 @@ pip install plotly open3d jupyter trimesh
|
|
|
36
36
|
pip install build twine
|
|
37
37
|
rm -rf dist
|
|
38
38
|
python -m build --sdist
|
|
39
|
-
twine upload dist/*
|
|
39
|
+
twine upload dist/* --verbose
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
# Reference
|
|
@@ -66,5 +66,7 @@ series = {EGGH-HPG'12}
|
|
|
66
66
|
## Repository
|
|
67
67
|
- [cuBQL](https://github.com/NVIDIA/cuBQL)
|
|
68
68
|
- [cudaKDTree](https://github.com/ingowald/cudaKDTree)
|
|
69
|
-
- [Kaolin]
|
|
70
|
-
- [Pytorch3D]
|
|
69
|
+
- [Kaolin](https://github.com/NVIDIAGameWorks/kaolin)
|
|
70
|
+
- [Pytorch3D](https://github.com/facebookresearch/pytorch3d)
|
|
71
|
+
- [Open3D](https://www.open3d.org/)
|
|
72
|
+
- [trimesh](https://github.com/mikedh/trimesh)
|
|
@@ -4,7 +4,7 @@ Geocutool Python bindings
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
import torch
|
|
6
6
|
import typing
|
|
7
|
-
__all__: list[str] = ['BVH', 'GSBVH', 'KDTree', 'PGSBVH', 'compute_gs_aabb_func', 'compute_gs_covi_func', 'solve_gs_neighbor_mahalanobis_radius_func', 'solve_pgs_cluster_tangency_radius_func']
|
|
7
|
+
__all__: list[str] = ['BVH', 'GSBVH', 'KDTree', 'MeshBVH', 'PGSBVH', 'TriangleMesh', 'compute_gs_aabb_func', 'compute_gs_covi_func', 'create_sphere', 'solve_gs_neighbor_mahalanobis_radius_func', 'solve_pgs_cluster_tangency_radius_func']
|
|
8
8
|
class BVH:
|
|
9
9
|
def __init__(self, in_aabb_mins: torch.Tensor, in_aabb_maxs: torch.Tensor) -> None:
|
|
10
10
|
"""
|
|
@@ -14,6 +14,10 @@ class BVH:
|
|
|
14
14
|
"""
|
|
15
15
|
Query the BVH with bounding boxes or segments. Returns (query_ids, object_ids).
|
|
16
16
|
"""
|
|
17
|
+
def query_self(self) -> tuple[torch.Tensor, torch.Tensor]:
|
|
18
|
+
"""
|
|
19
|
+
Query the BVH against itself. Returns unique overlapping (query_ids, object_ids).
|
|
20
|
+
"""
|
|
17
21
|
class GSBVH(BVH):
|
|
18
22
|
def __init__(self, in_aabb_mins: torch.Tensor, in_aabb_maxs: torch.Tensor) -> None:
|
|
19
23
|
"""
|
|
@@ -40,6 +44,19 @@ class KDTree:
|
|
|
40
44
|
"""
|
|
41
45
|
Queries the KDTree for the K nearest neighbors.
|
|
42
46
|
"""
|
|
47
|
+
class MeshBVH(BVH):
|
|
48
|
+
def __init__(self, in_aabb_mins: torch.Tensor, in_aabb_maxs: torch.Tensor) -> None:
|
|
49
|
+
"""
|
|
50
|
+
Construct MeshBVH from Triangle AABBs.
|
|
51
|
+
"""
|
|
52
|
+
def get_self_intersection(self, vertices: torch.Tensor, triangles: torch.Tensor) -> torch.Tensor:
|
|
53
|
+
"""
|
|
54
|
+
Find all self-intersecting triangle pairs
|
|
55
|
+
"""
|
|
56
|
+
def is_self_intersection(self, vertices: torch.Tensor, triangles: torch.Tensor) -> bool:
|
|
57
|
+
"""
|
|
58
|
+
Check if there are any self-intersecting triangle pairs
|
|
59
|
+
"""
|
|
43
60
|
class PGSBVH(BVH):
|
|
44
61
|
def __init__(self, in_aabb_mins: torch.Tensor, in_aabb_maxs: torch.Tensor) -> None:
|
|
45
62
|
"""
|
|
@@ -53,6 +70,91 @@ class PGSBVH(BVH):
|
|
|
53
70
|
"""
|
|
54
71
|
Perform exact Broad-to-Narrow phase intersection between Voxels and PGS.
|
|
55
72
|
"""
|
|
73
|
+
class TriangleMesh:
|
|
74
|
+
def __init__(self, in_vertices: torch.Tensor, in_triangles: torch.Tensor, in_vertex_normals: torch.Tensor | None = None, in_vertex_colors: torch.Tensor | None = None) -> None:
|
|
75
|
+
...
|
|
76
|
+
def build_bvh(self) -> MeshBVH:
|
|
77
|
+
...
|
|
78
|
+
def compute_edges_to_triangle_map(self) -> None:
|
|
79
|
+
...
|
|
80
|
+
def compute_triangle_areas(self) -> None:
|
|
81
|
+
...
|
|
82
|
+
def compute_triangle_normals(self) -> None:
|
|
83
|
+
...
|
|
84
|
+
def compute_vertices_to_triangle_map(self) -> None:
|
|
85
|
+
...
|
|
86
|
+
def get_edges_to_triangle_map(self) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
87
|
+
...
|
|
88
|
+
def get_non_manifold_vertices(self) -> torch.Tensor:
|
|
89
|
+
...
|
|
90
|
+
def get_self_intersection(self) -> torch.Tensor:
|
|
91
|
+
...
|
|
92
|
+
def get_vertices_to_triangle_map(self) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
93
|
+
...
|
|
94
|
+
def is_edge_manifold(self, allow_boundary_edge: bool = True) -> bool:
|
|
95
|
+
...
|
|
96
|
+
def is_manifold(self, allow_boundary_edge: bool = True) -> bool:
|
|
97
|
+
...
|
|
98
|
+
def is_self_intersection(self) -> bool:
|
|
99
|
+
...
|
|
100
|
+
def is_vertex_manifold(self) -> bool:
|
|
101
|
+
...
|
|
102
|
+
def remove_triangles_by_mask(self, keep_mask: torch.Tensor) -> None:
|
|
103
|
+
...
|
|
104
|
+
@property
|
|
105
|
+
def bvh(self) -> MeshBVH:
|
|
106
|
+
...
|
|
107
|
+
@property
|
|
108
|
+
def edge_to_triangle_counts(self) -> torch.Tensor:
|
|
109
|
+
...
|
|
110
|
+
@property
|
|
111
|
+
def edge_to_triangle_indices(self) -> torch.Tensor:
|
|
112
|
+
...
|
|
113
|
+
@property
|
|
114
|
+
def edge_to_triangle_offsets(self) -> torch.Tensor:
|
|
115
|
+
...
|
|
116
|
+
@property
|
|
117
|
+
def edges(self) -> torch.Tensor:
|
|
118
|
+
...
|
|
119
|
+
@property
|
|
120
|
+
def euler_characteristic(self) -> int:
|
|
121
|
+
...
|
|
122
|
+
@property
|
|
123
|
+
def genus(self) -> int:
|
|
124
|
+
...
|
|
125
|
+
@property
|
|
126
|
+
def num_triangles(self) -> int:
|
|
127
|
+
...
|
|
128
|
+
@property
|
|
129
|
+
def surface_area(self) -> torch.Tensor:
|
|
130
|
+
...
|
|
131
|
+
@property
|
|
132
|
+
def triangle_areas(self) -> torch.Tensor:
|
|
133
|
+
...
|
|
134
|
+
@property
|
|
135
|
+
def triangle_normals(self) -> torch.Tensor:
|
|
136
|
+
...
|
|
137
|
+
@property
|
|
138
|
+
def triangles(self) -> torch.Tensor:
|
|
139
|
+
...
|
|
140
|
+
@property
|
|
141
|
+
def vertex_colors(self) -> torch.Tensor:
|
|
142
|
+
...
|
|
143
|
+
@property
|
|
144
|
+
def vertex_normals(self) -> torch.Tensor:
|
|
145
|
+
...
|
|
146
|
+
@property
|
|
147
|
+
def vertex_to_triangle_counts(self) -> torch.Tensor:
|
|
148
|
+
...
|
|
149
|
+
@property
|
|
150
|
+
def vertex_to_triangle_indices(self) -> torch.Tensor:
|
|
151
|
+
...
|
|
152
|
+
@property
|
|
153
|
+
def vertex_to_triangle_offsets(self) -> torch.Tensor:
|
|
154
|
+
...
|
|
155
|
+
@property
|
|
156
|
+
def vertices(self) -> torch.Tensor:
|
|
157
|
+
...
|
|
56
158
|
def compute_gs_aabb_func(means: torch.Tensor, scales: torch.Tensor, covis: torch.Tensor, isos: torch.Tensor | None, iso: float, tol: float, level: int) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
57
159
|
"""
|
|
58
160
|
Compute AABB for 3D Gaussians
|
|
@@ -61,6 +163,10 @@ def compute_gs_covi_func(means: torch.Tensor, rotations: torch.Tensor, scales: t
|
|
|
61
163
|
"""
|
|
62
164
|
Compute covariance matrices for 3D Gaussians
|
|
63
165
|
"""
|
|
166
|
+
def create_sphere(sectors: int = 32, stacks: int = 16, radius: float = 1.0) -> tuple[torch.Tensor, torch.Tensor]:
|
|
167
|
+
"""
|
|
168
|
+
Creates a UV sphere returning (vertices, triangles) tensors on the CPU.
|
|
169
|
+
"""
|
|
64
170
|
def solve_gs_neighbor_mahalanobis_radius_func(means: torch.Tensor, covis: torch.Tensor, k: int) -> torch.Tensor:
|
|
65
171
|
"""
|
|
66
172
|
Solve Gaussian Neighbor Mahalanobis Radius
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import torch
|
|
2
|
+
from typing import Tuple
|
|
3
|
+
|
|
4
|
+
from .._C import create_sphere as create_sphere_c
|
|
5
|
+
|
|
6
|
+
def create_sphere(
|
|
7
|
+
sectors: int = 32,
|
|
8
|
+
stacks: int = 16,
|
|
9
|
+
radius: float = 1.0
|
|
10
|
+
) -> Tuple[torch.Tensor, torch.Tensor]:
|
|
11
|
+
"""
|
|
12
|
+
Creates a UV sphere returning (vertices, triangles) tensors on the CPU.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
sectors (int, optional): Number of longitudinal sectors. Defaults to 32.
|
|
16
|
+
stacks (int, optional): Number of latitudinal stacks. Defaults to 16.
|
|
17
|
+
radius (float, optional): Radius of the sphere. Defaults to 1.0.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
vertices: (N, 3) float32 tensor of vertex positions.
|
|
21
|
+
triangles: (M, 3) int32 tensor of triangle indices.
|
|
22
|
+
"""
|
|
23
|
+
return create_sphere_c(sectors, stacks, radius)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#include <torch/extension.h>
|
|
2
|
+
#include <pybind11/pybind11.h>
|
|
3
|
+
#include "../../creation/triangle_creation.h"
|
|
4
|
+
|
|
5
|
+
namespace py = pybind11;
|
|
6
|
+
|
|
7
|
+
void bind_creation_triangle_creation(py::module_& m) {
|
|
8
|
+
m.def("create_sphere", &triangle_creation::create_sphere,
|
|
9
|
+
py::arg("sectors") = 32,
|
|
10
|
+
py::arg("stacks") = 16,
|
|
11
|
+
py::arg("radius") = 1.0f,
|
|
12
|
+
"Creates a UV sphere returning (vertices, triangles) tensors on the CPU.");
|
|
13
|
+
}
|
|
@@ -120,7 +120,40 @@ std::tuple<torch::Tensor, torch::Tensor> BVH::query(
|
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
std::tuple<torch::Tensor, torch::Tensor> BVH::query_self()
|
|
124
|
+
{
|
|
125
|
+
auto options_int64 = this->aabb_mins.options().dtype(torch::kInt64);
|
|
126
|
+
|
|
127
|
+
if (this->num_objects == 0) {
|
|
128
|
+
throw std::runtime_error("Cannot query BVH with 0 objects.");
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
torch::Tensor out_query_ids = torch::empty({BVH_MAX_CAPACITY}, options_int64);
|
|
132
|
+
torch::Tensor out_object_ids = torch::empty({BVH_MAX_CAPACITY}, options_int64);
|
|
133
|
+
torch::Tensor hit_counter = torch::zeros({1}, options_int64);
|
|
134
|
+
|
|
135
|
+
bvh::query_self(
|
|
136
|
+
this->num_objects,
|
|
137
|
+
reinterpret_cast<const float3 *>(this->aabb_mins.data_ptr<float>()),
|
|
138
|
+
reinterpret_cast<const float3 *>(this->aabb_maxs.data_ptr<float>()),
|
|
139
|
+
reinterpret_cast<const int2 *>(this->bvh_children.data_ptr<int>()),
|
|
140
|
+
reinterpret_cast<const int *>(this->object_ids.data_ptr<int>()),
|
|
141
|
+
reinterpret_cast<int64_t *>(out_query_ids.data_ptr<int64_t>()),
|
|
142
|
+
reinterpret_cast<int64_t *>(out_object_ids.data_ptr<int64_t>()),
|
|
143
|
+
reinterpret_cast<int64_t *>(hit_counter.data_ptr<int64_t>()),
|
|
144
|
+
static_cast<int64_t>(BVH_MAX_CAPACITY)
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
int64_t num_hits = hit_counter.item<int64_t>();
|
|
148
|
+
num_hits = std::min(num_hits, static_cast<int64_t>(BVH_MAX_CAPACITY));
|
|
149
|
+
|
|
150
|
+
return std::make_tuple(
|
|
151
|
+
out_query_ids.slice(0, 0, num_hits),
|
|
152
|
+
out_object_ids.slice(0, 0, num_hits)
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
void bind_ds_bvh(py::module_& m)
|
|
124
157
|
{
|
|
125
158
|
py::class_<BVH>(m, "BVH")
|
|
126
159
|
.def(py::init<const torch::Tensor &, const torch::Tensor &>(),
|
|
@@ -131,5 +164,8 @@ void bind_ds_bvh(py::module &m)
|
|
|
131
164
|
.def("query", &BVH::query,
|
|
132
165
|
py::arg("query_aabb_mins"),
|
|
133
166
|
py::arg("query_aabb_maxs"),
|
|
134
|
-
"Query the BVH with bounding boxes or segments. Returns (query_ids, object_ids).")
|
|
167
|
+
"Query the BVH with bounding boxes or segments. Returns (query_ids, object_ids).")
|
|
168
|
+
|
|
169
|
+
.def("query_self", &BVH::query_self,
|
|
170
|
+
"Query the BVH against itself. Returns unique overlapping (query_ids, object_ids).");
|
|
135
171
|
}
|
|
@@ -312,7 +312,7 @@ std::tuple<torch::Tensor, torch::Tensor> GSBVH::query_edge(
|
|
|
312
312
|
return std::make_tuple(hit_mask, out_gaus_ids);
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
void bind_ds_gs_bvh(py::
|
|
315
|
+
void bind_ds_gs_bvh(py::module_& m)
|
|
316
316
|
{
|
|
317
317
|
py::class_<GSBVH, BVH>(m, "GSBVH")
|
|
318
318
|
.def(py::init<const torch::Tensor &, const torch::Tensor &>(),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#include <torch/extension.h>
|
|
2
|
+
#include "../../data_structure/mesh_bvh.h"
|
|
3
|
+
#include <pybind11/pybind11.h>
|
|
4
|
+
|
|
5
|
+
namespace py = pybind11;
|
|
6
|
+
|
|
7
|
+
void bind_ds_mesh_bvh(py::module_& m)
|
|
8
|
+
{
|
|
9
|
+
py::class_<MeshBVH, BVH>(m, "MeshBVH")
|
|
10
|
+
.def(py::init<const torch::Tensor &, const torch::Tensor &>(),
|
|
11
|
+
py::arg("in_aabb_mins"),
|
|
12
|
+
py::arg("in_aabb_maxs"),
|
|
13
|
+
"Construct MeshBVH from Triangle AABBs.")
|
|
14
|
+
.def("get_self_intersection", &MeshBVH::get_self_intersection,
|
|
15
|
+
py::arg("vertices"),
|
|
16
|
+
py::arg("triangles"),
|
|
17
|
+
"Find all self-intersecting triangle pairs")
|
|
18
|
+
.def("is_self_intersection", &MeshBVH::is_self_intersection,
|
|
19
|
+
py::arg("vertices"),
|
|
20
|
+
py::arg("triangles"),
|
|
21
|
+
"Check if there are any self-intersecting triangle pairs");
|
|
22
|
+
}
|
|
@@ -222,7 +222,7 @@ std::tuple<torch::Tensor, torch::Tensor> PGSBVH::query_edge(
|
|
|
222
222
|
return std::make_tuple(hit_mask, out_gaus_ids);
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
void bind_ds_pgs_bvh(py::
|
|
225
|
+
void bind_ds_pgs_bvh(py::module_& m)
|
|
226
226
|
{
|
|
227
227
|
py::class_<PGSBVH, BVH>(m, "PGSBVH")
|
|
228
228
|
.def(py::init<const torch::Tensor &, const torch::Tensor &>(),
|