diwi / space_partitioning_octree_bvh Goto Github PK
View Code? Open in Web Editor NEWOctree/BVH: building and traversal (for fast ray-triangle-intersection)
Home Page: http://thomasdiewald.com/blog/?p=1488
Octree/BVH: building and traversal (for fast ray-triangle-intersection)
Home Page: http://thomasdiewald.com/blog/?p=1488
java 1.7 throws this exception:
> start building
Exception in thread "Animation Thread" java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeLo(TimSort.java:747)
at java.util.TimSort.mergeAt(TimSort.java:483)
at java.util.TimSort.mergeCollapse(TimSort.java:410)
at java.util.TimSort.sort(TimSort.java:214)
at java.util.TimSort.sort(TimSort.java:173)
at java.util.Arrays.sort(Arrays.java:659)
at java.util.Collections.sort(Collections.java:217)
at DwBVH.BvhBuilder.subdivide(BvhBuilder.java:87)
at DwBVH.BvhBuilder.subdivide(BvhBuilder.java:122)
at DwBVH.BvhBuilder.subdivide(BvhBuilder.java:122)
at DwBVH.BvhBuilder.subdivide(BvhBuilder.java:121)
at DwBVH.BvhBuilder.subdivide(BvhBuilder.java:121)
at DwBVH.BvhBuilder.BUILD_defaultRoutine(BvhBuilder.java:66)
at DwBVH.Bvh.BUILD_defaultRoutine(Bvh.java:62)
at SpacePartitioning.MAIN_bvh_octree_demo.setup(MAIN_bvh_octree_demo.java:144)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:744)
Great project! However, there is a small bug: If you create a BVH with only one face and select it with the mouse, then an exception is thrown. The problem is this line:
this.stack = new BvhTraversalData[bvh.getMaxDepth()*2];
A tree with only a root node has a max depth of 0 => the stack has a size of 0. A fix would be to make the stack slightly bigger:
this.stack = new BvhTraversalData[bvh.getMaxDepth()*2 + 1];
How do you use this code, from within Processing, or just javac
at the CLI?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.