Skip to content

Commit

Permalink
renamed IBVH.jl to ImplicitBVH.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
anicusan committed Jul 1, 2023
1 parent 5ce9794 commit 9996c17
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 80 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "IBVH"
name = "ImplicitBVH"
uuid = "932a18dc-bb55-4cd5-bdd6-1368ec9cea29"
authors = ["Andrei Leonard Nicusan"]
version = "0.2.0"
Expand Down
4 changes: 2 additions & 2 deletions benchmark/bvh_build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# Date : 15.12.2022


using IBVH
using IBVH: BSphere, BBox
using ImplicitBVH
using ImplicitBVH: BSphere, BBox

using MeshIO
using FileIO
Expand Down
4 changes: 2 additions & 2 deletions benchmark/bvh_contact.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# Date : 15.12.2022


using IBVH
using IBVH: BSphere, BBox
using ImplicitBVH
using ImplicitBVH: BSphere, BBox

using MeshIO
using FileIO
Expand Down
14 changes: 7 additions & 7 deletions benchmark/morton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# Date : 29.06.2023


using IBVH
using IBVH: BSphere, BBox
using ImplicitBVH
using ImplicitBVH: BSphere, BBox

using MeshIO
using FileIO
Expand All @@ -27,18 +27,18 @@ mesh = load(joinpath(@__DIR__, "xyzrgb_dragon.obj"))
bounding_spheres = [LeafType(tri) for tri in mesh]

# Pre-compile bounding volume extrema computation
IBVH.bounding_volumes_extrema(bounding_spheres)
ImplicitBVH.bounding_volumes_extrema(bounding_spheres)
println("Bounding volume extrema:")
display(@benchmark(IBVH.bounding_volumes_extrema(bounding_spheres)))
display(@benchmark(ImplicitBVH.bounding_volumes_extrema(bounding_spheres)))

# Pre-compile morton encoding
mortons = IBVH.morton_encode(bounding_spheres, MortonType)
mortons = ImplicitBVH.morton_encode(bounding_spheres, MortonType)
println("Morton encoding:")
display(@benchmark(IBVH.morton_encode(bounding_spheres, MortonType)))
display(@benchmark(ImplicitBVH.morton_encode(bounding_spheres, MortonType)))

# Collect a pprof profile of the complete build
Profile.clear()
@profile IBVH.morton_encode(bounding_spheres, MortonType)
@profile ImplicitBVH.morton_encode(bounding_spheres, MortonType)

# Export pprof profile and open interactive profiling web interface.
pprof(; out="morton.pb.gz")
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
IBVH = "932a18dc-bb55-4cd5-bdd6-1368ec9cea29"
ImplicitBVH = "932a18dc-bb55-4cd5-bdd6-1368ec9cea29"
8 changes: 4 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using IBVH
using ImplicitBVH
using Documenter

makedocs(
modules = [IBVH],
sitename = "IBVH.jl",
modules = [ImplicitBVH],
sitename = "ImplicitBVH.jl",
format = Documenter.HTML(
# Only create web pretty-URLs on the CI
prettyurls = get(ENV, "CI", nothing) == "true",
),
)
deploydocs(repo = "github.com/StellaOrg/IBVH.jl.git")
deploydocs(repo = "github.com/StellaOrg/ImplicitBVH.jl.git")
14 changes: 7 additions & 7 deletions docs/src/bounding_volumes.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Bounding Volumes

```@docs
IBVH.BBox
IBVH.BSphere
ImplicitBVH.BBox
ImplicitBVH.BSphere
```

## Query Functions

```@docs
IBVH.iscontact
IBVH.center
IBVH.radius
IBVH.lower
IBVH.upper
ImplicitBVH.iscontact
ImplicitBVH.center
ImplicitBVH.radius
ImplicitBVH.lower
ImplicitBVH.upper
```
6 changes: 3 additions & 3 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# IBVH.jl Documentation
# ImplicitBVH.jl Documentation


## BVH Construction & Traversal
Expand All @@ -11,8 +11,8 @@ traverse

```@docs
BVHTraversal
IBVH.BVHStats
IBVH.IndexPair
ImplicitBVH.BVHStats
ImplicitBVH.IndexPair
```

## Index
Expand Down
14 changes: 7 additions & 7 deletions docs/src/morton.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@


```@docs
IBVH.MortonUnsigned
IBVH.morton_encode
IBVH.morton_encode!
IBVH.morton_encode_single
IBVH.morton_scaling
IBVH.morton_split3
IBVH.bounding_volumes_extrema
ImplicitBVH.MortonUnsigned
ImplicitBVH.morton_encode
ImplicitBVH.morton_encode!
ImplicitBVH.morton_encode_single
ImplicitBVH.morton_scaling
ImplicitBVH.morton_split3
ImplicitBVH.bounding_volumes_extrema
```
2 changes: 1 addition & 1 deletion docs/src/utilities.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Utilities

```@docs
IBVH.TaskPartitioner
ImplicitBVH.TaskPartitioner
```
6 changes: 3 additions & 3 deletions src/IBVH.jl → src/ImplicitBVH.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# File : OIBVH.jl
# File : ImplicitBVH.jl
# License: MIT
# Author : Andrei Leonard Nicusan <a.l.nicusan@bham.ac.uk>
# Date : 02.06.2022


module IBVH
module ImplicitBVH

# Functionality exported by this package by default
export BVH, BVHTraversal, traverse
Expand All @@ -26,4 +26,4 @@ include("bounding_volumes.jl")
include("ibvh_build.jl")
include("ibvh_traverse.jl")

end # module IBVH
end # module ImplicitBVH
22 changes: 11 additions & 11 deletions src/ibvh_build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ Tree Level Nodes & Leaves Build Up Traverse Down
) where {L, N, U <: MortonUnsigned}
# Fields
tree::ImplicitTree{Int}
nodes::VN <: AbstractVector
leaves::VL <: AbstractVector
order::VO <: AbstractVector
built_level::Int
stats::BVHStats
- `tree::`[`ImplicitTree`](@ref)`{Int}`
- `nodes::VN <: AbstractVector`
- `leaves::VL <: AbstractVector`
- `order::VO <: AbstractVector`
- `built_level::Int`
- `stats::`[`BVHStats`](@ref)
# Examples
Simple usage with bounding spheres and default 64-bit types:
```jldoctest
using IBVH
using IBVH: BSphere
using ImplicitBVH
using ImplicitBVH: BSphere
using StaticArrays
# Generate some simple bounding spheres
Expand Down Expand Up @@ -91,8 +91,8 @@ Using `Float32` bounding spheres for leaves, `Float32` bounding boxes for nodes
Morton codes:
```jldoctest
using IBVH
using IBVH: BBox, BSphere
using ImplicitBVH
using ImplicitBVH: BBox, BSphere
using StaticArrays
# Generate some simple bounding spheres
Expand Down Expand Up @@ -177,7 +177,7 @@ function BVH(
end


# Build OIBVH nodes above the leaf-level from the bottom up, inplace
# Build ImplicitBVH nodes above the leaf-level from the bottom up, inplace
function aggregate_oibvh!(bvh_nodes, bvh_leaves, tree, order, built_level=1)

# Special case: aggregate level above leaves - might have different node types
Expand Down
4 changes: 2 additions & 2 deletions src/ibvh_traverse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ traversals.
# Examples
```jldoctest
using IBVH
using IBVH: BBox, BSphere
using ImplicitBVH
using ImplicitBVH: BBox, BSphere
using StaticArrays
# Generate some simple bounding spheres
Expand Down
2 changes: 1 addition & 1 deletion src/implicit_tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ breadth-first search.
# Examples
```julia
julia> using IBVH
julia> using ImplicitBVH
# Given 5 geometric elements (e.g. bounding boxes) we construct the following implicit tree
# having the 5 real leaves at implicit indices 8-12 plus 3 virtual leaves.
Expand Down
4 changes: 2 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ elements per task.
# Examples
```jldoctest
using IBVH: TaskPartitioner
using ImplicitBVH: TaskPartitioner
# Divide 10 elements between 4 tasks
tp = TaskPartitioner(10, 4)
Expand All @@ -29,7 +29,7 @@ tp[i] = (10, 10)
```
```jldoctest
using IBVH: TaskPartitioner
using ImplicitBVH: TaskPartitioner
# Divide 20 elements between 6 tasks with minimum 5 elements per task.
# Not all tasks will be required
Expand Down
51 changes: 25 additions & 26 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using IBVH
using IBVH: BBox, BSphere
using ImplicitBVH
using ImplicitBVH: BBox, BSphere

using Test
using Random
Expand Down Expand Up @@ -202,43 +202,42 @@ end

# Single numbers
x = UInt32(0x111)
m = IBVH.morton_split3(x)
m = ImplicitBVH.morton_split3(x)
@test m == 0x1001001

x = UInt64(0x111)
m = IBVH.morton_split3(x)
m = ImplicitBVH.morton_split3(x)
@test m == 0x1001001

# Random bounding volumes
Random.seed!(42)

bv = map(BSphere, [rand(3, 3) for _ in 1:10])
IBVH.morton_encode(bv, UInt32)
IBVH.morton_encode(bv, UInt64)
IBVH.morton_encode(bv)
ImplicitBVH.morton_encode(bv, UInt32)
ImplicitBVH.morton_encode(bv, UInt64)
ImplicitBVH.morton_encode(bv)

bv = map(BBox, [rand(3, 3) for _ in 1:10])
IBVH.morton_encode(bv, UInt32)
IBVH.morton_encode(bv, UInt64)
IBVH.morton_encode(bv)
ImplicitBVH.morton_encode(bv, UInt32)
ImplicitBVH.morton_encode(bv, UInt64)
ImplicitBVH.morton_encode(bv)

bv = map(BSphere{Float32}, [rand(3, 3) for _ in 1:10])
IBVH.morton_encode(bv, UInt32)
IBVH.morton_encode(bv, UInt64)
IBVH.morton_encode(bv)
ImplicitBVH.morton_encode(bv, UInt32)
ImplicitBVH.morton_encode(bv, UInt64)
ImplicitBVH.morton_encode(bv)

bv = map(BBox{Float32}, [rand(3, 3) for _ in 1:10])
IBVH.morton_encode(bv, UInt32)
IBVH.morton_encode(bv, UInt64)
IBVH.morton_encode(bv)
ImplicitBVH.morton_encode(bv, UInt32)
ImplicitBVH.morton_encode(bv, UInt64)
ImplicitBVH.morton_encode(bv)

# Degenerate inputs
a = BSphere(SVector{3}((0., 0., 0.)), 0.5)
b = BSphere(SVector{3}((1., 0., 0.)), 0.1)
IBVH.morton_encode([a, b], UInt32)
IBVH.morton_encode([a, a], UInt32)
IBVH.morton_encode([a], UInt32)

ImplicitBVH.morton_encode([a, b], UInt32)
ImplicitBVH.morton_encode([a, a], UInt32)
ImplicitBVH.morton_encode([a], UInt32)
end


Expand All @@ -255,7 +254,7 @@ end
BSphere(SA[0., 0, 4], 0.6),
]

# Build the following IBVH from 5 bounding volumes:
# Build the following ImplicitBVH from 5 bounding volumes:
#
# Nodes & Leaves Tree Level
# 1 1
Expand Down Expand Up @@ -294,7 +293,7 @@ end
BSphere(SA[0., 0, 3], 0.4),
]

# Build the following IBVH from 5 bounding volumes:
# Build the following ImplicitBVH from 5 bounding volumes:
#
# Nodes & Leaves Tree Level
# 1 1
Expand Down Expand Up @@ -329,21 +328,21 @@ end
bvs = map(BSphere, [6 * rand(3) .+ rand(3, 3) for _ in 1:100])

# Brute force contact detection
brute_contacts = IBVH.IndexPair[]
brute_contacts = ImplicitBVH.IndexPair[]
for i in 1:length(bvs)
for j in i + 1:length(bvs)
if IBVH.iscontact(bvs[i], bvs[j])
if ImplicitBVH.iscontact(bvs[i], bvs[j])
push!(brute_contacts, (i, j))
end
end
end

# IBVH-based contact detection
# ImplicitBVH-based contact detection
bvh = BVH(bvs, BBox{Float64})
traversal = traverse(bvh)
bvh_contacts = traversal.contacts

# Ensure IBVH finds same contacts as checking all possible pairs
# Ensure ImplicitBVH finds same contacts as checking all possible pairs
@test length(brute_contacts) == length(bvh_contacts)
for brute_contact in brute_contacts
@test brute_contact in bvh_contacts
Expand Down

0 comments on commit 9996c17

Please sign in to comment.