Comments (3)
Thanks for your sharing your observations under Windows and glad to hear that my implementation also works there. Did you encounter any other issues when porting the code to windows?
I only tested my implementation under Linux Ubuntu 14.04, but did not spend sooo much time on squeezing out every bit of performance. I generally often decided to stay with a more readable version instead of trying to optimize every statement. For me the optimization from using -O3 -DNDEBUG
from gcc were enough. But if you need the fastest possible version, there are certainly plenty of opportunities and tricks to further speed up the tree.
As far as I remember, the std::pow
had no significant drawback with ggc under Ubuntu 14.04. Therefore, I decided to stay with std::pow
for readibility.
The replacement of the std::vector
with an std::array
is definitely more readable and makes totally sense, but needs C++11 compatible compiler, which I currently don't require. As almost all common compilers now support C++11, it might be a good addition.
from octree.
Jess,
You could replace the arrays with simple uint32_t childStarts[8] = { .... } and it would be almost as legible, with the dowside of not having bounds checking in debug. But I don't think you need to really worry about that in this use case since the number of elements is well known.
Regarding the std::pow, it may we ll be that gcc's implementation handles an explicit exponent of 2 and unrolls it, but visual studio does not. That would explain it not showing up in your use case.
The only other porting issue I had required that I cast one value from size_t to uint32_t - on line 393:
const uint32_t N = pts.size();
becomes
const uint32_t N = (uint32_t)pts.size();
I am running 64 bit so the size_t is a uint64_t - I decided to cast it to a uint32_t because I couldn't imagine having any more points than uint32_t could handle, but really some sort of range test should probably be included, or the N should be a size_t, and everything else dependent on it follow suit.
As for speed optimizations, if I had the time I would investigate changing the node pointers to 32 bit indices, an allocating the nodes out of a pool - this is always a performance win, but complicates legibility.
Thanks again for the implementation - I was going to roll my own but yours is superior.
from octree.
Thanks again for your comment. I put the changes on my TODO list and hopefully can return to this issue soon.
Good luck with your project and glad to hear that my implementation helped someone.
from octree.
Related Issues (13)
- Why make the Octree not copyable and assignable? HOT 1
- findNeighbor function problem HOT 1
- How to add it to cmake project? HOT 2
- Extend to find closest N neighbors HOT 1
- Enhancement: Eigen support HOT 1
- If it's possible to update the octree? HOT 1
- can colour be in point attribute? HOT 1
- How to sort a set of 3D points? HOT 1
- Bug in overlaps method HOT 2
- Consider Linearizing the Tree HOT 5
- Stack overlow - there are no maximum depth termination conditions HOT 2
- Removal of single points HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from octree.