jbikker / tinybvh

Single-header BVH construction and traversal library.
MIT License
530 stars 25 forks source link

Excellant project! Can I use it for simple distance querying? #22

Closed metorm closed 2 weeks ago

metorm commented 2 weeks ago

I'm not very familiar with computer graphics, but I know that bvh is often related to shortest distance computation.

I wonder if there is currently code in the project that can be used directly to calculate the shortest distance from a point to a triangular discrete mesh. And where should I start reading to try it out.

TheSFReader commented 2 weeks ago

As far as I understand the code here (No expert or anything), there us no code that does shortest distance from a point to a triangular discrete mesh in the current code base, and I think it will probably not be since the author's attention and intention seems to be mainly on ray tracing applications.

I also don't know if/how the heuristic used to build the BVH is optimum for that shortest distance search.

However, it's probably not realy difficult to write traversal/intersection code using tinybvh as a basis.

jbikker commented 2 weeks ago

Indeed! I can definitely imagine using this for applications other than ray tracing, and I will be happy to accept pull requests for traversal code!