Efficient AABB/triangle intersection in C#

后端 未结 2 1341
失恋的感觉
失恋的感觉 2020-12-28 23:29

Can anyone recommend an efficient port to CSharp of any of the public AABB/triangle intersection algorithms.

I\'ve been looking at Moller\'s approach, described abst

2条回答
  •  甜味超标
    2020-12-29 00:15

    I noticed a small bug in this implementation which leads to false negatives. If your triangle has one edge parallel to one axis (for example (1, 0, 0)), then you will have a null vector when computing

    triangleEdges[i].Cross(boxNormals[j])
    

    This will lead to equality in the test below and give you a false negative.

    replace <= and >= by < and > at line

     if (boxMax <= triangleMin || boxMin >= triangleMax)
    

    (strict comparers to remove those cases).

    Works well except for that!

    Thank you

提交回复
热议问题