Algorithm for checking if 3D point inside convex polyhedron (square pyramid)

后端 未结 2 2030
既然无缘
既然无缘 2021-01-16 21:42

I am looking robust collision detection algorithms and found an awesome book called Realtime Collision Detection by Christer Ericson. I am trying to use a p

2条回答
  •  -上瘾入骨i
    2021-01-16 21:57

    here's a similar question

    Basically your shape is a polyhedron but that is simply defined as a shape with many faces normally 6. You need to actually be looking for the name tetrahedron which is the classic pyramid shape you have defined in the visual representation above. But the basic answer is taking the normal of your 5 planes (the 4 triangles and one square), and check if they are facing in the same direction of the point in space. If they all return false then your point is inside of the shape. If any one of them returns true then you are outside the shape. This type of test works for most convex shapes because there is no case where the planes are overlapping there normals.

提交回复
热议问题