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];
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];