bvh
Bounding volume hierarchy data structure library written in TypeScript. Specifically implemented for 3-dimensional points.
Demo
Use
const BVHBuilderAsync BVHVector3 = ; // Have an array of faces (array of stride 9)const faceArray = 00 00 00 // Normal triangle 00 00 10 10 00 00; // Generate the Bounding Volume Hierachy from an array of facesconst maxTrianglesPerNode = 5;const BVH = ; // Find ray intersectionsconst intersections = BVH;
Considerations
Bounding Volume Hierarchies trade memory for ray intersection computation speed.
- If you are not memory bound, you will want a low maxTrianglesPerNode to minimize intersection speed.
- As you decrease maxTrianglesPerNode, a log/log relationship vs the number of nodes created is observed.
- At 1 maxTrianglesPerNode you get the fastest ray intersection speed, but have the highest memory overhead.
Development
npm install
npm start
Navigate to: http://localhost:8080/
to see a local copy of the GitHub Pages.
Goals
- Be asyncronous when possible.
- Be efficient with memory.
- Be fast when intersecting.
License
Original Copyright (c) 2015 Ben Raziel.
Modified Copyright (c) 2018 Josh Callebaut.
MIT License