conquer3d 0.2.7__tar.gz → 0.2.8__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.7/conquer3d.egg-info → conquer3d-0.2.8}/PKG-INFO +5 -1
- conquer3d-0.2.8/conquer3d/_C.pyi +592 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/_C.so +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/__init__.py +2 -1
- conquer3d-0.2.8/conquer3d/csrc/binds/creation/triangle_creation.cpp +23 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/binds/data_structure/bvh.cpp +77 -41
- conquer3d-0.2.8/conquer3d/csrc/binds/data_structure/grid.cpp +66 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/binds/data_structure/gs_bvh.cpp +61 -6
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/binds/data_structure/kdtree.cpp +20 -3
- conquer3d-0.2.8/conquer3d/csrc/binds/data_structure/mesh_bvh.cpp +299 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/binds/data_structure/pgs_bvh.cpp +52 -12
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/binds/data_structure/triangle_mesh.cpp +269 -75
- conquer3d-0.2.8/conquer3d/csrc/binds/ops/mc.cpp +37 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/check.h +1 -1
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/constants.h +1 -0
- conquer3d-0.2.8/conquer3d/csrc/ops/mc.cu +489 -0
- conquer3d-0.2.8/conquer3d/csrc/ops/mc.h +24 -0
- conquer3d-0.2.8/conquer3d/csrc/ops/mc_data.h +319 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/pybind.cpp +7 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/data_structure/__init__.py +1 -1
- conquer3d-0.2.8/conquer3d/ops/__init__.py +7 -0
- conquer3d-0.2.8/conquer3d/ops/grid.py +26 -0
- conquer3d-0.2.8/conquer3d/ops/marching_cubes.py +42 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8/conquer3d.egg-info}/PKG-INFO +5 -1
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d.egg-info/SOURCES.txt +8 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d.egg-info/requires.txt +5 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/pyproject.toml +7 -2
- {conquer3d-0.2.7 → conquer3d-0.2.8}/setup.py +12 -6
- conquer3d-0.2.7/conquer3d/_C.pyi +0 -213
- conquer3d-0.2.7/conquer3d/csrc/binds/creation/triangle_creation.cpp +0 -13
- conquer3d-0.2.7/conquer3d/csrc/binds/data_structure/mesh_bvh.cpp +0 -238
- {conquer3d-0.2.7 → conquer3d-0.2.8}/LICENSE +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/MANIFEST.in +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/README.md +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/creation/__init__.py +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/creation/triangle_creation.py +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/binds/primitive/gs.cpp +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/binds/primitive/pgs.cpp +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/creation/triangle_creation.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/bvh.cu +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/bvh.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/gs_bvh.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/kdtree.cu +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/kdtree.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/mesh_bvh.cu +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/mesh_bvh.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/pgs_bvh.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/triangle_mesh.cu +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/triangle_mesh.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/data_structure/zcurve.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/maths/f2x2.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/maths/f3x1.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/maths/f3x3.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/maths/f3x4.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/maths/f4x1.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/maths/f4x4.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/maths/maths.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/maths/ops.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/aabb.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/edge.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/gs.cu +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/gs.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/gs_aabb.cu +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/gs_math.cuh +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/pgs.cu +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/pgs.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/pgs_aabb.cu +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/pgs_math.cuh +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/ray.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/csrc/primitive/triangles.h +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/primitive/__init__.py +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/primitive/gs.py +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d/primitive/pgs.py +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d.egg-info/dependency_links.txt +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d.egg-info/not-zip-safe +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/conquer3d.egg-info/top_level.txt +0 -0
- {conquer3d-0.2.7 → conquer3d-0.2.8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: conquer3d
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: Geometric Cuda Tool Box
|
|
5
5
|
Author-email: Do Hoang Khoi <khoido8899@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -20,6 +20,10 @@ Requires-Dist: pytest>=7.0; extra == "dev"
|
|
|
20
20
|
Requires-Dist: black>=23.0; extra == "dev"
|
|
21
21
|
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
22
22
|
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
23
|
+
Provides-Extra: docs
|
|
24
|
+
Requires-Dist: mkdocs-material; extra == "docs"
|
|
25
|
+
Requires-Dist: mkdocstrings[python]; extra == "docs"
|
|
26
|
+
Requires-Dist: mkdocs-jupyter; extra == "docs"
|
|
23
27
|
Dynamic: license-file
|
|
24
28
|
|
|
25
29
|
# Conquer3D
|
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Geocutool Python bindings
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
import torch
|
|
6
|
+
import typing
|
|
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
|
+
class BVH:
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
A highly efficient Bounding Volume Hierarchy (LBVH) data structure natively backed by CUDA.
|
|
12
|
+
"""
|
|
13
|
+
def __init__(self, in_aabb_mins: torch.Tensor, in_aabb_maxs: torch.Tensor) -> None:
|
|
14
|
+
"""
|
|
15
|
+
Construct and build the Karras LBVH from Gaussian AABBs.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
in_aabb_mins (torch.Tensor): Shape (N, 3) float32 tensor of AABB minimum coordinates.
|
|
19
|
+
in_aabb_maxs (torch.Tensor): Shape (N, 3) float32 tensor of AABB maximum coordinates.
|
|
20
|
+
"""
|
|
21
|
+
def query(self, query_aabb_mins: torch.Tensor, query_aabb_maxs: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
|
|
22
|
+
"""
|
|
23
|
+
Query the BVH with bounding boxes or segments.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
query_aabb_mins (torch.Tensor): Shape (M, 3) float32 tensor of query AABB minimum coordinates.
|
|
27
|
+
query_aabb_maxs (torch.Tensor): Shape (M, 3) float32 tensor of query AABB maximum coordinates.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
tuple: (query_ids, object_ids)
|
|
31
|
+
"""
|
|
32
|
+
def query_point(self, query_points: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
33
|
+
"""
|
|
34
|
+
Find the closest leaf AABB to each query point.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
query_points (torch.Tensor): Shape (M, 3) float32 tensor of query points.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
tuple: (query_ids, object_ids, distances)
|
|
41
|
+
"""
|
|
42
|
+
def query_ray(self, ray_origins: torch.Tensor, ray_dirs: torch.Tensor, max_capacity: int = 10000000) -> tuple[torch.Tensor, torch.Tensor]:
|
|
43
|
+
"""
|
|
44
|
+
Find all ray-AABB intersections.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
ray_origins (torch.Tensor): Shape (M, 3) float32 tensor of ray origins.
|
|
48
|
+
ray_dirs (torch.Tensor): Shape (M, 3) float32 tensor of ray directions.
|
|
49
|
+
max_capacity (int): Maximum global capacity for recording intersections. Defaults to BVH_MAX_CAPACITY.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
tuple: (ray_ids, object_ids)
|
|
53
|
+
"""
|
|
54
|
+
def query_self(self) -> tuple[torch.Tensor, torch.Tensor]:
|
|
55
|
+
"""
|
|
56
|
+
Query the BVH against itself.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
tuple: (query_ids, object_ids) representing unique overlapping pairs.
|
|
60
|
+
"""
|
|
61
|
+
class GSBVH(BVH):
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
A specialized Bounding Volume Hierarchy for Gaussian Splatting operations.
|
|
65
|
+
Inherits from BVH.
|
|
66
|
+
"""
|
|
67
|
+
def __init__(self, in_aabb_mins: torch.Tensor, in_aabb_maxs: torch.Tensor) -> None:
|
|
68
|
+
"""
|
|
69
|
+
Construct and build the Karras LBVH for Gaussians.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
in_aabb_mins (torch.Tensor): Shape (N, 3) float32 tensor of Gaussian AABB minimums.
|
|
73
|
+
in_aabb_maxs (torch.Tensor): Shape (N, 3) float32 tensor of Gaussian AABB maximums.
|
|
74
|
+
"""
|
|
75
|
+
def query_edge(self, edge_starts: torch.Tensor, edge_ends: torch.Tensor, means: torch.Tensor, opacities: torch.Tensor, covis: torch.Tensor, isos: float | torch.Tensor = 11.345) -> tuple[torch.Tensor, torch.Tensor]:
|
|
76
|
+
"""
|
|
77
|
+
Find the single highest-density Gaussian intersected by each line segment.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
edge_starts (torch.Tensor): Shape (E, 3) float32 tensor of edge start points.
|
|
81
|
+
edge_ends (torch.Tensor): Shape (E, 3) float32 tensor of edge end points.
|
|
82
|
+
means (torch.Tensor): Shape (N, 3) float32 tensor of Gaussian means.
|
|
83
|
+
opacities (torch.Tensor): Shape (N,) float32 tensor of Gaussian opacities.
|
|
84
|
+
covis (torch.Tensor): Shape (N, 6) float32 tensor of Gaussian inverse covariances.
|
|
85
|
+
isos (float | torch.Tensor): Iso-surface threshold. Defaults to ISO.
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
tuple: (hit_mask, gaussian_ids)
|
|
89
|
+
"""
|
|
90
|
+
def query_edge_pair(self, edge_starts: torch.Tensor, edge_ends: torch.Tensor, means: torch.Tensor, covis: torch.Tensor, isos: float | torch.Tensor = 11.345, max_capacity: int = 10000000) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
91
|
+
"""
|
|
92
|
+
Find all Gaussians intersected by each line segment.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
edge_starts (torch.Tensor): Shape (E, 3) float32 tensor of edge start points.
|
|
96
|
+
edge_ends (torch.Tensor): Shape (E, 3) float32 tensor of edge end points.
|
|
97
|
+
means (torch.Tensor): Shape (N, 3) float32 tensor of Gaussian means.
|
|
98
|
+
covis (torch.Tensor): Shape (N, 6) float32 tensor of Gaussian inverse covariances.
|
|
99
|
+
isos (float | torch.Tensor): Iso-surface threshold. Can be a float or (N,) tensor. Defaults to ISO.
|
|
100
|
+
max_capacity (int): Max global capacity for hits. Defaults to BVH_MAX_CAPACITY.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
tuple: (hit_mask, edge_ids, gaussian_ids)
|
|
104
|
+
"""
|
|
105
|
+
def query_voxel_pair(self, vx_aabb_mins: torch.Tensor, vx_aabb_maxs: torch.Tensor, means: torch.Tensor, covis: torch.Tensor, opacities: torch.Tensor, gs_aabb_mins: torch.Tensor, gs_aabb_maxs: torch.Tensor, contact_points: torch.Tensor, isos: float | torch.Tensor = 11.345, ar_threshold: float = 0.0, p_threshold: float = 0.0, return_centroids: bool = False, max_capacity: int = 10000000) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor | None, torch.Tensor | None]:
|
|
106
|
+
"""
|
|
107
|
+
Perform exact Broad-to-Narrow phase intersection between Voxels and Gaussians.
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
vx_aabb_mins (torch.Tensor): Shape (M, 3) float32 tensor of voxel AABB minimums.
|
|
111
|
+
vx_aabb_maxs (torch.Tensor): Shape (M, 3) float32 tensor of voxel AABB maximums.
|
|
112
|
+
means (torch.Tensor): Shape (N, 3) float32 tensor of Gaussian means.
|
|
113
|
+
covis (torch.Tensor): Shape (N, 6) float32 tensor of Gaussian inverse covariances.
|
|
114
|
+
opacities (torch.Tensor): Shape (N,) float32 tensor of Gaussian opacities.
|
|
115
|
+
gs_aabb_mins (torch.Tensor): Shape (N, 3) float32 tensor of Gaussian AABB minimums.
|
|
116
|
+
gs_aabb_maxs (torch.Tensor): Shape (N, 3) float32 tensor of Gaussian AABB maximums.
|
|
117
|
+
contact_points (torch.Tensor): Shape (N, 3) float32 tensor of contact points.
|
|
118
|
+
isos (float | torch.Tensor): Iso-surface threshold. Can be a float or (N,) float32 tensor. Defaults to ISO.
|
|
119
|
+
ar_threshold (float): Alpha scaling threshold. Defaults to 0.0.
|
|
120
|
+
p_threshold (float): Probability threshold. Defaults to 0.0.
|
|
121
|
+
return_centroids (bool): Whether to compute and return intersection centroids/densities. Defaults to false.
|
|
122
|
+
max_capacity (int): Max global capacity for hits. Defaults to BVH_MAX_CAPACITY.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
tuple: (hit_mask, voxel_ids, gaussian_ids, centroids, densities)
|
|
126
|
+
"""
|
|
127
|
+
class KDTree:
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
A highly efficient KDTree data structure natively backed by CUDA.
|
|
131
|
+
"""
|
|
132
|
+
def __init__(self, points: torch.Tensor) -> None:
|
|
133
|
+
"""
|
|
134
|
+
Initializes and builds the KDTree on the GPU.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
points (torch.Tensor): Shape (N, 3) float32 tensor of points to build the KDTree.
|
|
138
|
+
"""
|
|
139
|
+
def query(self, query_points: torch.Tensor, k: int = 1, exclude_self: bool = False) -> tuple[torch.Tensor, torch.Tensor]:
|
|
140
|
+
"""
|
|
141
|
+
Queries the KDTree for the K nearest neighbors.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
query_points (torch.Tensor): Shape (M, 3) float32 tensor of query points.
|
|
145
|
+
k (int): Number of nearest neighbors to search for. Defaults to 1.
|
|
146
|
+
exclude_self (bool): Whether to exclude the exact query point (if it exists). Defaults to false.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
tuple: (distances, indices)
|
|
150
|
+
"""
|
|
151
|
+
class MeshBVH(BVH):
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
A specialized Bounding Volume Hierarchy for Triangle Meshes.
|
|
155
|
+
Inherits from BVH.
|
|
156
|
+
"""
|
|
157
|
+
def __init__(self, in_aabb_mins: torch.Tensor, in_aabb_maxs: torch.Tensor) -> None:
|
|
158
|
+
"""
|
|
159
|
+
Construct MeshBVH from Triangle AABBs.
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
in_aabb_mins (torch.Tensor): Shape (M, 3) float32 tensor of triangle AABB minimums.
|
|
163
|
+
in_aabb_maxs (torch.Tensor): Shape (M, 3) float32 tensor of triangle AABB maximums.
|
|
164
|
+
"""
|
|
165
|
+
def build_winding_data(self, vertices: torch.Tensor, triangles: torch.Tensor) -> None:
|
|
166
|
+
"""
|
|
167
|
+
Computes the hierarchical area-weighted constants for Fast Winding Number queries.
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
vertices (torch.Tensor): Shape (N, 3) float32 tensor of vertices.
|
|
171
|
+
triangles (torch.Tensor): Shape (M, 3) int32 tensor of triangles.
|
|
172
|
+
"""
|
|
173
|
+
def get_ray_intersection(self, ray_origins: torch.Tensor, ray_dirs: torch.Tensor, vertices: torch.Tensor, triangles: torch.Tensor, return_distance: bool = False) -> typing.Any:
|
|
174
|
+
"""
|
|
175
|
+
Find all ray-triangle intersections.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
ray_origins (torch.Tensor): Shape (R, 3) float32 tensor of ray origins.
|
|
179
|
+
ray_dirs (torch.Tensor): Shape (R, 3) float32 tensor of ray directions.
|
|
180
|
+
vertices (torch.Tensor): Shape (N, 3) float32 tensor of vertices.
|
|
181
|
+
triangles (torch.Tensor): Shape (M, 3) int32 tensor of triangles.
|
|
182
|
+
return_distance (bool): Whether to compute and return ray hit distances. Defaults to false.
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
tuple: (ray_ids, triangle_ids, intersect_points, [distances])
|
|
186
|
+
"""
|
|
187
|
+
def get_self_intersection(self, vertices: torch.Tensor, triangles: torch.Tensor) -> torch.Tensor:
|
|
188
|
+
"""
|
|
189
|
+
Find all self-intersecting triangle pairs.
|
|
190
|
+
|
|
191
|
+
Args:
|
|
192
|
+
vertices (torch.Tensor): Shape (N, 3) float32 tensor of vertices.
|
|
193
|
+
triangles (torch.Tensor): Shape (M, 3) int32 tensor of triangles.
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
torch.Tensor: Shape (K, 2) int64 tensor of intersecting triangle index pairs.
|
|
197
|
+
"""
|
|
198
|
+
def is_self_intersection(self, vertices: torch.Tensor, triangles: torch.Tensor) -> bool:
|
|
199
|
+
"""
|
|
200
|
+
Check if there are any self-intersecting triangle pairs.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
vertices (torch.Tensor): Shape (N, 3) float32 tensor of vertices.
|
|
204
|
+
triangles (torch.Tensor): Shape (M, 3) int32 tensor of triangles.
|
|
205
|
+
|
|
206
|
+
Returns:
|
|
207
|
+
bool: True if there is at least one self-intersection.
|
|
208
|
+
"""
|
|
209
|
+
def query_point(self, query_points: torch.Tensor, vertices: torch.Tensor, triangles: torch.Tensor, return_sdf: bool = False, return_prj_pts: bool = True, sign_mode: int = 0) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
210
|
+
"""
|
|
211
|
+
Find the closest triangle to each query point.
|
|
212
|
+
|
|
213
|
+
Args:
|
|
214
|
+
query_points (torch.Tensor): Shape (Q, 3) float32 tensor of query points.
|
|
215
|
+
vertices (torch.Tensor): Shape (N, 3) float32 tensor of vertices.
|
|
216
|
+
triangles (torch.Tensor): Shape (M, 3) int32 tensor of triangles.
|
|
217
|
+
return_sdf (bool): Whether to compute signed distances instead of unsigned. Defaults to false.
|
|
218
|
+
return_prj_pts (bool): Whether to compute and return projected points. Defaults to true.
|
|
219
|
+
sign_mode (int): Winding number method (0 for ray casting, 1 for fast winding number). Defaults to 0.
|
|
220
|
+
|
|
221
|
+
Returns:
|
|
222
|
+
tuple: (query_ids, triangle_ids, projected_points, distances)
|
|
223
|
+
"""
|
|
224
|
+
class PGSBVH(BVH):
|
|
225
|
+
"""
|
|
226
|
+
|
|
227
|
+
A specialized Bounding Volume Hierarchy for Planar Gaussian Splatting (PGS) operations.
|
|
228
|
+
Inherits from BVH.
|
|
229
|
+
"""
|
|
230
|
+
def __init__(self, in_aabb_mins: torch.Tensor, in_aabb_maxs: torch.Tensor) -> None:
|
|
231
|
+
"""
|
|
232
|
+
Construct and build the Karras LBVH for Planar Gaussians.
|
|
233
|
+
|
|
234
|
+
Args:
|
|
235
|
+
in_aabb_mins (torch.Tensor): Shape (N, 3) float32 tensor of PGS AABB minimums.
|
|
236
|
+
in_aabb_maxs (torch.Tensor): Shape (N, 3) float32 tensor of PGS AABB maximums.
|
|
237
|
+
"""
|
|
238
|
+
def query_edge(self, edge_starts: torch.Tensor, edge_ends: torch.Tensor, means: torch.Tensor, normals: torch.Tensor, opacities: torch.Tensor, covis: torch.Tensor, isos: float | torch.Tensor = 11.345) -> tuple[torch.Tensor, torch.Tensor]:
|
|
239
|
+
"""
|
|
240
|
+
Find the single highest-density PGS intersected by each line segment.
|
|
241
|
+
|
|
242
|
+
Args:
|
|
243
|
+
edge_starts (torch.Tensor): Shape (E, 3) float32 tensor of edge start points.
|
|
244
|
+
edge_ends (torch.Tensor): Shape (E, 3) float32 tensor of edge end points.
|
|
245
|
+
means (torch.Tensor): Shape (N, 3) float32 tensor of PGS means.
|
|
246
|
+
normals (torch.Tensor): Shape (N, 3) float32 tensor of PGS normals.
|
|
247
|
+
opacities (torch.Tensor): Shape (N,) float32 tensor of PGS opacities.
|
|
248
|
+
covis (torch.Tensor): Shape (N, 3) float32 tensor of PGS inverse covariances.
|
|
249
|
+
isos (float | torch.Tensor): Iso-surface threshold. Defaults to ISO.
|
|
250
|
+
|
|
251
|
+
Returns:
|
|
252
|
+
tuple: (hit_mask, gaussian_ids)
|
|
253
|
+
"""
|
|
254
|
+
def query_voxel_pair(self, vx_aabb_mins: torch.Tensor, vx_aabb_maxs: torch.Tensor, means: torch.Tensor, normals: torch.Tensor, covis: torch.Tensor, gs_aabb_mins: torch.Tensor, gs_aabb_maxs: torch.Tensor, isos: float | torch.Tensor = 11.345, return_centroids: bool = False, return_centroid_densities: bool = False, max_capacity: int = 10000000) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor | None, torch.Tensor | None]:
|
|
255
|
+
"""
|
|
256
|
+
Perform exact Broad-to-Narrow phase intersection between Voxels and PGS.
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
vx_aabb_mins (torch.Tensor): Shape (M, 3) float32 tensor of voxel AABB minimums.
|
|
260
|
+
vx_aabb_maxs (torch.Tensor): Shape (M, 3) float32 tensor of voxel AABB maximums.
|
|
261
|
+
means (torch.Tensor): Shape (N, 3) float32 tensor of PGS means.
|
|
262
|
+
normals (torch.Tensor): Shape (N, 3) float32 tensor of PGS normals.
|
|
263
|
+
covis (torch.Tensor): Shape (N, 3) float32 tensor of PGS inverse covariances.
|
|
264
|
+
gs_aabb_mins (torch.Tensor): Shape (N, 3) float32 tensor of PGS AABB minimums.
|
|
265
|
+
gs_aabb_maxs (torch.Tensor): Shape (N, 3) float32 tensor of PGS AABB maximums.
|
|
266
|
+
isos (float | torch.Tensor): Iso-surface threshold. Can be a float or (N,) float32 tensor. Defaults to ISO.
|
|
267
|
+
return_centroids (bool): Whether to compute and return intersection centroids. Defaults to false.
|
|
268
|
+
return_centroid_densities (bool): Whether to return densities at centroids. Defaults to false.
|
|
269
|
+
max_capacity (int): Max global capacity for hits. Defaults to 10000000.
|
|
270
|
+
|
|
271
|
+
Returns:
|
|
272
|
+
tuple: (hit_mask, voxel_ids, gaussian_ids, centroids, densities)
|
|
273
|
+
"""
|
|
274
|
+
class TriangleMesh:
|
|
275
|
+
"""
|
|
276
|
+
|
|
277
|
+
A highly efficient Triangle Mesh data structure natively backed by CUDA.
|
|
278
|
+
|
|
279
|
+
Args:
|
|
280
|
+
in_vertices (torch.Tensor): A tensor of shape (N, 3) containing float32 vertex coordinates.
|
|
281
|
+
in_triangles (torch.Tensor): A tensor of shape (M, 3) containing int32 triangle indices.
|
|
282
|
+
in_vertex_normals (torch.Tensor, optional): A tensor of shape (N, 3) containing float32 vertex normals. Defaults to None.
|
|
283
|
+
in_vertex_colors (torch.Tensor, optional): A tensor of shape (N, 3) containing float32 vertex colors. Defaults to None.
|
|
284
|
+
"""
|
|
285
|
+
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:
|
|
286
|
+
...
|
|
287
|
+
def build_bvh(self) -> MeshBVH:
|
|
288
|
+
"""
|
|
289
|
+
Builds and returns the Bounding Volume Hierarchy for the mesh.
|
|
290
|
+
|
|
291
|
+
Returns:
|
|
292
|
+
MeshBVH: The constructed BVH object.
|
|
293
|
+
"""
|
|
294
|
+
def compute_edges_to_triangle_map(self) -> None:
|
|
295
|
+
"""
|
|
296
|
+
Computes the edge-to-triangle connectivity map.
|
|
297
|
+
"""
|
|
298
|
+
def compute_triangle_areas(self) -> None:
|
|
299
|
+
"""
|
|
300
|
+
Computes the areas of all triangles.
|
|
301
|
+
"""
|
|
302
|
+
def compute_triangle_normals(self) -> None:
|
|
303
|
+
"""
|
|
304
|
+
Computes the normals for all triangles.
|
|
305
|
+
"""
|
|
306
|
+
def compute_vertex_normals(self) -> None:
|
|
307
|
+
"""
|
|
308
|
+
Computes area-weighted vertex normals.
|
|
309
|
+
"""
|
|
310
|
+
def compute_vertices_to_triangle_map(self) -> None:
|
|
311
|
+
"""
|
|
312
|
+
Computes the vertex-to-triangle connectivity map.
|
|
313
|
+
"""
|
|
314
|
+
def get_edges_to_triangle_map(self) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
315
|
+
"""
|
|
316
|
+
Gets the edge to triangle connectivity mapping.
|
|
317
|
+
|
|
318
|
+
Returns:
|
|
319
|
+
tuple: (edges, offsets, counts, indices)
|
|
320
|
+
"""
|
|
321
|
+
def get_non_manifold_vertices(self) -> torch.Tensor:
|
|
322
|
+
"""
|
|
323
|
+
Gets all non-manifold vertices.
|
|
324
|
+
|
|
325
|
+
Returns:
|
|
326
|
+
torch.Tensor: Tensor of vertex indices that are non-manifold.
|
|
327
|
+
"""
|
|
328
|
+
def get_ray_intersection(self, ray_origins: torch.Tensor, ray_dirs: torch.Tensor, return_distance: bool = False) -> typing.Any:
|
|
329
|
+
"""
|
|
330
|
+
Computes intersections between a batch of rays and the mesh triangles.
|
|
331
|
+
|
|
332
|
+
Args:
|
|
333
|
+
ray_origins (torch.Tensor): Shape (R, 3) float32 tensor of ray origins.
|
|
334
|
+
ray_dirs (torch.Tensor): Shape (R, 3) float32 tensor of ray directions.
|
|
335
|
+
return_distance (bool, optional): If True, returns intersection distances. Defaults to False.
|
|
336
|
+
|
|
337
|
+
Returns:
|
|
338
|
+
tuple: (ray_ids, triangle_ids, intersect_points, [distances])
|
|
339
|
+
"""
|
|
340
|
+
def get_self_intersection(self) -> torch.Tensor:
|
|
341
|
+
"""
|
|
342
|
+
Finds all self-intersecting triangle pairs in the mesh.
|
|
343
|
+
|
|
344
|
+
Returns:
|
|
345
|
+
torch.Tensor: A tensor of shape (K, 2) containing pairs of intersecting triangle indices.
|
|
346
|
+
"""
|
|
347
|
+
def get_vertices_to_triangle_map(self) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
348
|
+
"""
|
|
349
|
+
Gets the vertex to triangle connectivity mapping.
|
|
350
|
+
|
|
351
|
+
Returns:
|
|
352
|
+
tuple: (offsets, counts, indices)
|
|
353
|
+
"""
|
|
354
|
+
def is_edge_manifold(self, allow_boundary_edge: bool = True) -> bool:
|
|
355
|
+
"""
|
|
356
|
+
Checks if the mesh is edge manifold.
|
|
357
|
+
|
|
358
|
+
Args:
|
|
359
|
+
allow_boundary_edge (bool, optional): Whether to permit boundary edges (count <= 2). Defaults to True.
|
|
360
|
+
|
|
361
|
+
Returns:
|
|
362
|
+
bool: True if the mesh is edge manifold.
|
|
363
|
+
"""
|
|
364
|
+
def is_manifold(self, allow_boundary_edge: bool = True) -> bool:
|
|
365
|
+
"""
|
|
366
|
+
Checks if the mesh is fully manifold (edge, vertex, and no self-intersections).
|
|
367
|
+
|
|
368
|
+
Args:
|
|
369
|
+
allow_boundary_edge (bool, optional): Whether to permit boundary edges. Defaults to True.
|
|
370
|
+
|
|
371
|
+
Returns:
|
|
372
|
+
bool: True if fully manifold.
|
|
373
|
+
"""
|
|
374
|
+
def is_self_intersection(self) -> bool:
|
|
375
|
+
"""
|
|
376
|
+
Checks whether the mesh contains any self-intersecting triangles.
|
|
377
|
+
|
|
378
|
+
Returns:
|
|
379
|
+
bool: True if there is at least one self-intersection, False otherwise.
|
|
380
|
+
"""
|
|
381
|
+
def is_vertex_manifold(self) -> bool:
|
|
382
|
+
"""
|
|
383
|
+
Checks if the mesh is vertex manifold.
|
|
384
|
+
|
|
385
|
+
Returns:
|
|
386
|
+
bool: True if all vertices are manifold.
|
|
387
|
+
"""
|
|
388
|
+
def query_points(self, query_pts: torch.Tensor, return_sdf: bool = False, return_prj_pts: bool = True, sign_mode: int = 0, distance_mode: int = 0) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
389
|
+
"""
|
|
390
|
+
Finds the closest triangles and computes distances/SDFs for query points.
|
|
391
|
+
|
|
392
|
+
Args:
|
|
393
|
+
query_pts (torch.Tensor): Shape (Q, 3) float32 tensor of query points.
|
|
394
|
+
return_sdf (bool, optional): Whether to return Signed Distance Field values. Defaults to False.
|
|
395
|
+
return_prj_pts (bool, optional): Whether to return projected points on the mesh. Defaults to True.
|
|
396
|
+
sign_mode (int, optional): The method for computing signs. Defaults to 0.
|
|
397
|
+
distance_mode (int, optional): Distance computation mode. Defaults to 0.
|
|
398
|
+
|
|
399
|
+
Returns:
|
|
400
|
+
tuple: (query_ids, triangle_ids, projected_points, distances)
|
|
401
|
+
"""
|
|
402
|
+
def remove_triangles_by_mask(self, keep_mask: torch.Tensor) -> None:
|
|
403
|
+
"""
|
|
404
|
+
Removes triangles from the mesh based on a boolean mask.
|
|
405
|
+
|
|
406
|
+
Args:
|
|
407
|
+
keep_mask (torch.Tensor): Shape (M,) boolean tensor indicating which triangles to keep.
|
|
408
|
+
"""
|
|
409
|
+
def sample_points(self, num_points: int, uniform: bool = False, return_normals: bool = False, return_colors: bool = False, use_triangle_normal: bool = True) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor | None, torch.Tensor | None]:
|
|
410
|
+
"""
|
|
411
|
+
Samples random points on the surface of the mesh.
|
|
412
|
+
|
|
413
|
+
Args:
|
|
414
|
+
num_points (int): The number of points to sample.
|
|
415
|
+
uniform (bool, optional): If True, samples uniformly by area. Defaults to False.
|
|
416
|
+
return_normals (bool, optional): If True, returns normals at sampled points. Defaults to False.
|
|
417
|
+
return_colors (bool, optional): If True, returns colors at sampled points. Defaults to False.
|
|
418
|
+
use_triangle_normal (bool, optional): If True, uses flat triangle normals instead of interpolated vertex normals. Defaults to True.
|
|
419
|
+
|
|
420
|
+
Returns:
|
|
421
|
+
tuple: (points, triangle_indices, [normals], [colors])
|
|
422
|
+
"""
|
|
423
|
+
@property
|
|
424
|
+
def bvh(self) -> MeshBVH:
|
|
425
|
+
"""
|
|
426
|
+
The Bounding Volume Hierarchy built for this mesh.
|
|
427
|
+
|
|
428
|
+
Returns:
|
|
429
|
+
MeshBVH - The Bounding Volume Hierarchy built for this mesh.
|
|
430
|
+
"""
|
|
431
|
+
@property
|
|
432
|
+
def edge_to_triangle_counts(self) -> torch.Tensor:
|
|
433
|
+
"""
|
|
434
|
+
Edge to triangle counts.
|
|
435
|
+
|
|
436
|
+
Returns:
|
|
437
|
+
torch.Tensor - Edge to triangle counts.
|
|
438
|
+
"""
|
|
439
|
+
@property
|
|
440
|
+
def edge_to_triangle_indices(self) -> torch.Tensor:
|
|
441
|
+
"""
|
|
442
|
+
Edge to triangle indices.
|
|
443
|
+
|
|
444
|
+
Returns:
|
|
445
|
+
torch.Tensor - Edge to triangle indices.
|
|
446
|
+
"""
|
|
447
|
+
@property
|
|
448
|
+
def edge_to_triangle_offsets(self) -> torch.Tensor:
|
|
449
|
+
"""
|
|
450
|
+
Edge to triangle offsets.
|
|
451
|
+
|
|
452
|
+
Returns:
|
|
453
|
+
torch.Tensor - Edge to triangle offsets.
|
|
454
|
+
"""
|
|
455
|
+
@property
|
|
456
|
+
def edges(self) -> torch.Tensor:
|
|
457
|
+
"""
|
|
458
|
+
Unique edges of the mesh.
|
|
459
|
+
|
|
460
|
+
Returns:
|
|
461
|
+
torch.Tensor - Shape (E, 2) int32 tensor of unique edges.
|
|
462
|
+
"""
|
|
463
|
+
@property
|
|
464
|
+
def euler_characteristic(self) -> int:
|
|
465
|
+
"""
|
|
466
|
+
The Euler characteristic (V - E + F) of the mesh.
|
|
467
|
+
|
|
468
|
+
Returns:
|
|
469
|
+
int - The Euler characteristic (V - E + F) of the mesh.
|
|
470
|
+
"""
|
|
471
|
+
@property
|
|
472
|
+
def genus(self) -> int:
|
|
473
|
+
"""
|
|
474
|
+
The topological genus of the mesh.
|
|
475
|
+
|
|
476
|
+
Returns:
|
|
477
|
+
int - The topological genus of the mesh.
|
|
478
|
+
"""
|
|
479
|
+
@property
|
|
480
|
+
def num_triangles(self) -> int:
|
|
481
|
+
"""
|
|
482
|
+
Total number of triangles.
|
|
483
|
+
|
|
484
|
+
Returns:
|
|
485
|
+
int - Total number of triangles.
|
|
486
|
+
"""
|
|
487
|
+
@property
|
|
488
|
+
def surface_area(self) -> torch.Tensor:
|
|
489
|
+
"""
|
|
490
|
+
Total surface area of the mesh.
|
|
491
|
+
|
|
492
|
+
Returns:
|
|
493
|
+
torch.Tensor - Total surface area of the mesh.
|
|
494
|
+
"""
|
|
495
|
+
@property
|
|
496
|
+
def triangle_areas(self) -> torch.Tensor:
|
|
497
|
+
"""
|
|
498
|
+
Areas of each triangle.
|
|
499
|
+
|
|
500
|
+
Returns:
|
|
501
|
+
torch.Tensor - Shape (M,) float32 tensor of triangle areas.
|
|
502
|
+
"""
|
|
503
|
+
@property
|
|
504
|
+
def triangle_normals(self) -> torch.Tensor:
|
|
505
|
+
"""
|
|
506
|
+
Normals of each triangle.
|
|
507
|
+
|
|
508
|
+
Returns:
|
|
509
|
+
torch.Tensor - Shape (M, 3) float32 tensor of triangle normals.
|
|
510
|
+
"""
|
|
511
|
+
@property
|
|
512
|
+
def triangles(self) -> torch.Tensor:
|
|
513
|
+
"""
|
|
514
|
+
Mesh triangles.
|
|
515
|
+
|
|
516
|
+
Returns:
|
|
517
|
+
torch.Tensor - Shape (M, 3) int32 tensor of triangles.
|
|
518
|
+
"""
|
|
519
|
+
@property
|
|
520
|
+
def vertex_colors(self) -> torch.Tensor:
|
|
521
|
+
"""
|
|
522
|
+
Vertex colors.
|
|
523
|
+
|
|
524
|
+
Returns:
|
|
525
|
+
torch.Tensor - Shape (N, 3) float32 tensor of vertex colors.
|
|
526
|
+
"""
|
|
527
|
+
@property
|
|
528
|
+
def vertex_normals(self) -> torch.Tensor:
|
|
529
|
+
"""
|
|
530
|
+
Area-weighted vertex normals.
|
|
531
|
+
|
|
532
|
+
Returns:
|
|
533
|
+
torch.Tensor - Shape (N, 3) float32 tensor of vertex normals.
|
|
534
|
+
"""
|
|
535
|
+
@property
|
|
536
|
+
def vertex_to_triangle_counts(self) -> torch.Tensor:
|
|
537
|
+
"""
|
|
538
|
+
Vertex to triangle counts.
|
|
539
|
+
|
|
540
|
+
Returns:
|
|
541
|
+
torch.Tensor - Vertex to triangle counts.
|
|
542
|
+
"""
|
|
543
|
+
@property
|
|
544
|
+
def vertex_to_triangle_indices(self) -> torch.Tensor:
|
|
545
|
+
"""
|
|
546
|
+
Vertex to triangle indices.
|
|
547
|
+
|
|
548
|
+
Returns:
|
|
549
|
+
torch.Tensor - Vertex to triangle indices.
|
|
550
|
+
"""
|
|
551
|
+
@property
|
|
552
|
+
def vertex_to_triangle_offsets(self) -> torch.Tensor:
|
|
553
|
+
"""
|
|
554
|
+
Vertex to triangle offsets.
|
|
555
|
+
|
|
556
|
+
Returns:
|
|
557
|
+
torch.Tensor - Vertex to triangle offsets.
|
|
558
|
+
"""
|
|
559
|
+
@property
|
|
560
|
+
def vertices(self) -> torch.Tensor:
|
|
561
|
+
"""
|
|
562
|
+
Mesh vertices coordinates.
|
|
563
|
+
|
|
564
|
+
Returns:
|
|
565
|
+
torch.Tensor - Shape (N, 3) float32 tensor of vertices.
|
|
566
|
+
"""
|
|
567
|
+
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]:
|
|
568
|
+
"""
|
|
569
|
+
Compute AABB for 3D Gaussians
|
|
570
|
+
"""
|
|
571
|
+
def compute_gs_covi_func(means: torch.Tensor, rotations: torch.Tensor, scales: torch.Tensor, rotnorm: bool, tol: float, level: int) -> torch.Tensor:
|
|
572
|
+
"""
|
|
573
|
+
Compute covariance matrices for 3D Gaussians
|
|
574
|
+
"""
|
|
575
|
+
def create_sphere(sectors: int = 32, stacks: int = 16, radius: float = 1.0) -> tuple[torch.Tensor, torch.Tensor]:
|
|
576
|
+
"""
|
|
577
|
+
Creates a UV sphere returning (vertices, triangles) tensors on the CPU.
|
|
578
|
+
|
|
579
|
+
Args:
|
|
580
|
+
sectors (int): The number of longitudinal sectors. Defaults to 32.
|
|
581
|
+
stacks (int): The number of latitudinal stacks. Defaults to 16.
|
|
582
|
+
radius (float): The radius of the sphere. Defaults to 1.0.
|
|
583
|
+
|
|
584
|
+
Returns:
|
|
585
|
+
tuple: A tuple containing the vertices tensor and the triangles tensor.
|
|
586
|
+
"""
|
|
587
|
+
def solve_gs_neighbor_mahalanobis_radius_func(means: torch.Tensor, covis: torch.Tensor, k: int) -> torch.Tensor:
|
|
588
|
+
"""
|
|
589
|
+
Solve Gaussian Neighbor Mahalanobis Radius
|
|
590
|
+
"""
|
|
591
|
+
def solve_pgs_cluster_tangency_radius_func(means: torch.Tensor, normals: torch.Tensor, covis: torch.Tensor, k: int = 16) -> tuple[torch.Tensor, torch.Tensor]:
|
|
592
|
+
...
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
{
|
|
9
|
+
m.def("create_sphere", &triangle_creation::create_sphere,
|
|
10
|
+
py::arg("sectors") = 32,
|
|
11
|
+
py::arg("stacks") = 16,
|
|
12
|
+
py::arg("radius") = 1.0f,
|
|
13
|
+
R"doc(Creates a UV sphere returning (vertices, triangles) tensors on the CPU.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
sectors (int): The number of longitudinal sectors. Defaults to 32.
|
|
17
|
+
stacks (int): The number of latitudinal stacks. Defaults to 16.
|
|
18
|
+
radius (float): The radius of the sphere. Defaults to 1.0.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
tuple: A tuple containing the vertices tensor and the triangles tensor.
|
|
22
|
+
)doc");
|
|
23
|
+
}
|