射线体素相交
我想测试光线与体素场的交点。
我可以通过计算与当前体素边缘的射线盒相交来天真地爬过体素场,然后对下一个体素执行相同的操作,直到碰到某些东西。但是没有更快的方法来追踪体素场吗?我正在思考 3D 中的 Bresenham 线算法 的一些东西,可以快速给出我给定线相交的所有单元格。以前有人这样做过吗?
由于某些限制以及这些光线追踪并不经常发生的事实,我不想构建八叉树或任何其他数据结构。
I want to test for an intersection of a ray with a voxel field.
I could naively crawl through the voxel field by calculating a ray-box intersection with the edge of the current voxel, then doing the same for the next voxel until I hit something. But isn't there a faster way to trace through a voxel field? I was thinking something along the lines of Bresenham's line algorithm in 3D, something that could quickly give me all of the cells a given line intersects. Anyone done this before?
Due to certian limitations and the fact that these ray traces aren't happening that often, I do not want to build an octree or any other data structure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是 Bresenham 的 3D 实现。这是在matlab中;如果您不会说,您可以在此处查看 C 实现< /a>.
Here's an implementation of Bresenham's in 3D. It's in matlab; if you don't speak that you can see a C implementation here.
我相信八叉树算法可以满足您的要求。
I believe the octree-algorithm does what your asking for.