C ++包围盒三角形碰撞 [英] C++ bounding box triangle collision

查看:141
本文介绍了C ++包围盒三角形碰撞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要一种算法来确定边界框轴是否对齐(如一个立方体,但两边不相等)并且三角形相交于三维空间。我正在做C ++中的代码,如果解决方案非常长,在C ++中更好(如果可以的话):),如果它是几行,不用担心,如果它是另一种语言。



(确定三角形的顶点是否在框内很容易,但不容易确定框和三角形是否相交,但是所有顶点都在框和三角形的外面) p>

(三维空间中矩形和三角形交集的算法也很好,我可以将边界框划分为6个平面)$ b $最后我发现这个:
http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/code/

Bug修复代码是这样做的代码。



比ks给所有有答案的人)。

I need an algorithm for know if a bounding box axis align (like a cube but the sides are not equal) and a triangle intersect in a 3D space.

I am doing the code in C++, if the solution is extremly long, better in C++ (if you can) :), if it is a few lines don't worry if it is another language.

(Determine if a vertex of the triangle is inside the box is easy, but is not easy determine if if the box and the triangle intersects but all vertex are outside of the box and the triangle.)

(An algorithm of an intersection between a rectangle and a triangle in a 3d space is good too, I can divide the bounding box in 6 planes)

解决方案

Finally I found this: http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/code/

Bug-fixed code is a code for do this.

Thanks to all who have answer :).

这篇关于C ++包围盒三角形碰撞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆