尝试实时切片大型物体是否现实?(假设~1M tris)



所以,那个。我有一个带有网格的物体,它可能非常大,我希望能够用平面对其进行切片,以便只保留平面一侧的网格部分。

实时做到这一点是否可行?我意识到答案必然取决于硬件,所以一个广泛的答案是可以的。如果是这样,我应该如何处理这个问题?

将三角形网格与平面相交非常快。这是应有的检查点关于给定平面的一面很简单。只需使点和平面的点积法线并将其与平面"值"进行比较。我假设结果你还想要与平面相交的三角形,而不仅仅是正边的整个三角形。

我假设您将网格存储为点列表和三角形列表,其中每个三角形都用三个点索引表示。

有了这个,算法是:

For each point calculate dot product with plane normal
For each point calculate plane side it belongs. Positive or negative side or exactly on the plane.
For each triangle count number of it's points for each side.
  If all points are on positive side or on plane then take whole triangle
  If all points are on negative side or on plane then do not take triangle
  If some points are on positive side and some on negative side, calculate
         intersection points between triangle edges and plane and create triangles in a way:
     One point on positive side. Result is one triangle.
     Two points on positive side. Result is quadrilliteral, or two triangles.
     Plane intersect triangle exactly on one point. Similar to first case.

所有操作都很简单,并且与点数呈线性关系。有了这个整个算法应该很快。我认为它应该在一秒钟内与 1M trias 网格相交。

最新更新