Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add storage/kdtree #10

Merged
merged 4 commits into from
Oct 8, 2021
Merged

Add storage/kdtree #10

merged 4 commits into from
Oct 8, 2021

Conversation

at-wat
Copy link
Member

@at-wat at-wat commented Oct 7, 2021

Planning to use it for ICP registration.

goos: linux
goarch: amd64
pkg: github.com/seqsense/pcgol/pc/storage/kdtree
cpu: AMD Ryzen 9 3950X 16-Core Processor       
BenchmarkKDTree_Nearest/100points/KDTree    1675342    715.3 ns/op   201 B/op   5 allocs/op
BenchmarkKDTree_Nearest/100points/Naive     1263472    946.7 ns/op     0 B/op   0 allocs/op
BenchmarkKDTree_Nearest/1000points/KDTree    971581     1207 ns/op   329 B/op   8 allocs/op
BenchmarkKDTree_Nearest/1000points/Naive     131896     8678 ns/op     0 B/op   0 allocs/op
BenchmarkKDTree_Nearest/10000points/KDTree   884264     1319 ns/op   278 B/op   7 allocs/op
BenchmarkKDTree_Nearest/10000points/Naive     14004    85522 ns/op     0 B/op   0 allocs/op
BenchmarkKDTree_Nearest/100000points/KDTree  676402     1746 ns/op   415 B/op   7 allocs/op
BenchmarkKDTree_Nearest/100000points/Naive     1389   859469 ns/op     0 B/op   0 allocs/op

@at-wat at-wat self-assigned this Oct 7, 2021
@codecov
Copy link

codecov bot commented Oct 7, 2021

Codecov Report

Merging #10 (4a0b96b) into master (914b84a) will increase coverage by 4.72%.
The diff coverage is 91.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #10      +/-   ##
==========================================
+ Coverage   71.60%   76.33%   +4.72%     
==========================================
  Files          17       18       +1     
  Lines         789      883      +94     
==========================================
+ Hits          565      674     +109     
+ Misses        191      176      -15     
  Partials       33       33              
Impacted Files Coverage Δ
pc/storage/kdtree/kdtree.go 91.39% <91.39%> (ø)
pc/pointcloud.go 67.70% <0.00%> (+1.04%) ⬆️
mat/vec3.go 100.00% <0.00%> (+5.55%) ⬆️
pc/iterator.go 75.55% <0.00%> (+48.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 914b84a...4a0b96b. Read the comment docs.

Copy link
Collaborator

@f-fl0 f-fl0 left a comment

Choose a reason for hiding this comment

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

LGTM. Just left some minors comments.


var left, right *node
if mid > 0 {
left = newNode(ra, indice[0:mid], depth+1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[optional] Maybe it is better to be explicit but indice[0:mid] could just be indice[:mid] I believe.

left = newNode(ra, indice[0:mid], depth+1)
}
if mid+1 < len(indice) {
right = newNode(ra, indice[mid+1:len(indice)], depth+1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[optional] Same here for indice[mid+1:len(indice)]. It could be indice[mid+1:]

it.SetVec3(mat.Vec3{1, 0, 0}) // 5
it.Incr()
it.SetVec3(mat.Vec3{6, 2, 1}) // 6
it.Incr()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the call to it.Incr() is not necessary here.

@at-wat at-wat merged commit 1419522 into master Oct 8, 2021
@at-wat at-wat deleted the add-kdtree branch October 8, 2021 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants