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
7f935a0f
Commit
7f935a0f
authored
Aug 30, 2024
by
ashawkey
Browse files
fix safe_divide
parent
c46d664e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
include/cubvh/bounding_box.cuh
include/cubvh/bounding_box.cuh
+2
-2
include/cubvh/common.h
include/cubvh/common.h
+1
-1
No files found.
include/cubvh/bounding_box.cuh
View file @
7f935a0f
...
...
@@ -156,8 +156,8 @@ struct BoundingBox {
host_device_swap
(
tmin
,
tmax
);
}
float
tymin
=
safe_divide
(
min
.
y
()
-
pos
.
y
()
/
dir
.
y
());
float
tymax
=
safe_divide
(
max
.
y
()
-
pos
.
y
()
/
dir
.
y
());
float
tymin
=
safe_divide
(
min
.
y
()
-
pos
.
y
()
,
dir
.
y
());
float
tymax
=
safe_divide
(
max
.
y
()
-
pos
.
y
()
,
dir
.
y
());
if
(
tymin
>
tymax
)
{
host_device_swap
(
tymin
,
tymax
);
...
...
include/cubvh/common.h
View file @
7f935a0f
...
...
@@ -95,7 +95,7 @@ __device__ __host__ Eigen::Vector3f fibonacci_dir(uint32_t i, const Eigen::Vecto
return
cylindrical_to_dir
(
Eigen
::
Vector2f
{
fractf
((
i
+
epsilon
)
/
(
N_DIRS
-
1
+
2
*
epsilon
)
+
offset
.
x
()),
fractf
(
i
/
GOLDEN_RATIO
+
offset
.
y
())});
}
__host__
__device__
float
safe_divide
(
float
numerator
,
float
denominator
,
float
epsilon
=
1e-6
f
)
{
inline
__host__
__device__
float
safe_divide
(
float
numerator
,
float
denominator
,
float
epsilon
=
1e-6
f
)
{
if
(
fabs
(
denominator
)
<
epsilon
)
{
if
(
denominator
<=
0
)
return
-
(
numerator
/
epsilon
);
...
...
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