Ray voxel intersection

こ雲淡風輕ζ 提交于 2019-12-01 03:03:42

问题


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.


回答1:


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.




回答2:


I believe the octree-algorithm does what your asking for.



来源:https://stackoverflow.com/questions/5365019/ray-voxel-intersection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!