世界空间视图向量与世界点之间的交集
从屏幕坐标计算世界空间视图向量后(使用单击放大WebGL) ,给定一组顶点,如何找到世界空间中最近的交点?
after calculating the world space view vector from screen coordinates (using Click to zoom in WebGL), given an array of vertices, how do I find the closest intersecting point in world space?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您根据射线测试每个三角形。如果光线击中三角形,并且它比已知的最接近的击中点更近,您就会记住该点。循环直到不再有三角形。
http://www.lighthouse3d.com/tutorials/maths/ray-triangle-交集/
如果你使用很多三角形,那可能会很慢,所以你可以构建一个b树、八叉树、KD树或多分辨率网格碰撞结构,并在测试之前首先执行宽相碰撞结构的叶子中包含的三角形。
You test each triangle against the ray. If the ray hits the triangle, and if it is closer then the closest known hit, you remember that point. Loop until you have no more triangles.
http://www.lighthouse3d.com/tutorials/maths/ray-triangle-intersection/
If you're using many triangles, that may be slow, so you could build a b-tree, octree, KD-tree or multi-resolution grid collision structure and first perform a broad phase collision before testing triangles contained in a leaf of the structure.