Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
cubvh
Commits
6094bf8e
Commit
6094bf8e
authored
Feb 25, 2023
by
ashawkey
Browse files
add some notes
parent
0e2fca65
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
0 deletions
+3
-0
cubvh/api.py
cubvh/api.py
+1
-0
readme.md
readme.md
+1
-0
src/bvh.cu
src/bvh.cu
+1
-0
No files found.
cubvh/api.py
View file @
6094bf8e
...
@@ -18,6 +18,7 @@ class cuBVH():
...
@@ -18,6 +18,7 @@ class cuBVH():
if
torch
.
is_tensor
(
vertices
):
vertices
=
vertices
.
detach
().
cpu
().
numpy
()
if
torch
.
is_tensor
(
vertices
):
vertices
=
vertices
.
detach
().
cpu
().
numpy
()
if
torch
.
is_tensor
(
triangles
):
triangles
=
triangles
.
detach
().
cpu
().
numpy
()
if
torch
.
is_tensor
(
triangles
):
triangles
=
triangles
.
detach
().
cpu
().
numpy
()
# check inputs
assert
triangles
.
shape
[
0
]
>
8
,
"BVH needs at least 8 triangles."
assert
triangles
.
shape
[
0
]
>
8
,
"BVH needs at least 8 triangles."
# implementation
# implementation
...
...
readme.md
View file @
6094bf8e
...
@@ -24,6 +24,7 @@ import cubvh
...
@@ -24,6 +24,7 @@ import cubvh
### build BVH from mesh
### build BVH from mesh
mesh
=
trimesh
.
load
(
'example.ply'
)
mesh
=
trimesh
.
load
(
'example.ply'
)
# NOTE: you need to normalize the mesh first, since the max distance is hard-coded to 10.
BVH
=
cubvh
.
cuBVH
(
mesh
.
vertices
,
mesh
.
faces
)
# build with numpy.ndarray/torch.Tensor
BVH
=
cubvh
.
cuBVH
(
mesh
.
vertices
,
mesh
.
faces
)
# build with numpy.ndarray/torch.Tensor
### query ray-mesh intersection
### query ray-mesh intersection
...
...
src/bvh.cu
View file @
6094bf8e
...
@@ -411,6 +411,7 @@ public:
...
@@ -411,6 +411,7 @@ public:
for
(
uint32_t
i
=
0
;
i
<
N_STAB_RAYS
;
++
i
)
{
for
(
uint32_t
i
=
0
;
i
<
N_STAB_RAYS
;
++
i
)
{
// Use a Fibonacci lattice (with random offset) to regularly
// Use a Fibonacci lattice (with random offset) to regularly
// distribute the stab rays over the sphere.
// distribute the stab rays over the sphere.
// ref: http://extremelearning.com.au/how-to-evenly-distribute-points-on-a-sphere-more-effectively-than-the-canonical-fibonacci-lattice/
Vector3f
d
=
fibonacci_dir
<
N_STAB_RAYS
>
(
i
,
offset
);
Vector3f
d
=
fibonacci_dir
<
N_STAB_RAYS
>
(
i
,
offset
);
// If any of the stab rays goes outside the mesh, the SDF is positive.
// If any of the stab rays goes outside the mesh, the SDF is positive.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment