Skip to content

Commit

Permalink
computing the default_start_level just from the number of leaves; tes…
Browse files Browse the repository at this point in the history
…ting it always produces the same output as when using the BVH; cleaned codebase
  • Loading branch information
anicusan committed Jan 26, 2024
1 parent b0c5ec8 commit 54e21c4
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 910 deletions.
66 changes: 0 additions & 66 deletions src/traverse.jl

This file was deleted.

12 changes: 12 additions & 0 deletions src/traverse/traverse_single.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
default_start_level(bvh::BVH)::Int
default_start_level(num_leaves::Integer)::Int
Compute the default start level when traversing a single BVH tree.
"""
Expand All @@ -8,6 +9,17 @@ function default_start_level(bvh::BVH)
end


function default_start_level(num_leaves::Integer)
# Compute the default start level from the number of leaves (geometries) only
@boundscheck if num_leaves < 1
throw(DomainError(num_leaves, "must have at least one geometry!"))
end

levels = @inbounds ilog2(num_leaves, RoundUp) + 1 # number of binary tree levels
maximum2(levels ÷ 2, 1)
end


"""
traverse(
bvh::BVH,
Expand Down
Loading

2 comments on commit 54e21c4

@anicusan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: Version 0.4.0 already exists

Please sign in to comment.