算法部分填充多边形网格多边形、网格、算法、部分

2023-09-08 01:14:38 作者:傲性小祖宗

概述: 我有一个由3D多边形网格psented一个简单的塑料沙箱重$ P $。我需要能够倾倒的水的特定量到sandbox后,以确定水位。

Overview: I have a simple plastic sandbox represented by a 3D polygonal mesh. I need to be able to determine the water level after pouring a specific amount of water into the sandbox.

在水均匀地分布从什么时候倒以上 在没有流体模拟,水倒非常缓慢 这需要快速

问: 我可以用这个问题的是什么样的技术/算法?

Question: What kind of techniques/algorithms could I use for this problem?

我不是在寻找一个程序,或者可以做到这一点相似,只是算法 - 我会做的实施

I'm not looking for a program or similar that can do this, just algorithms - I'll do the implementation.

推荐答案

只是一个想法:

首先,计算所有的鞍点。像离散Morse理论或拓扑持久性工具的也许的是有用的在这里,但我了解得太少他们被肯定。接下来,您遍历所有鞍点,从最低和计算之后,水开始越过该点的时间点。这是在该较浅(以体积对表面积计)的两个相邻的盆地已达到的水平,该鞍点的高度相匹配的时间。从该点起,水注入到该表面将流至另一盆,并有助于其水位代替,直到两个盆地已达到同等水平。在此之后,它们将被看作是一个单个盆。一路上,你可能需要纠正时候,其他的鞍点必达,与流域变化有关的区域。你迭代为了增加时间,不增加高度(例如,使用具有减少键操作堆)。一旦最后一对盆地都具有相同的高度,你做;之后,只有一个盆地左

First you compute all saddle points. Tools like discrete morse theory or topological persistence might be useful here, but I know too little about them to be sure. Next you iterate over all saddle points, starting at the lowest, and compute the point in time after which water starts to cross that point. This is the time at which the shallower (in terms of volume versus surface area) of the two adjacent basins has reached a level that matches the height of that saddle point. From that point onward, water pouring onto that surface will flow over to the other basin and contribute to its water level instead, until the two basins have reached an equal level. After that, they will be treated as one single basin. Along the way you might have to correct the times when other saddle points will be reached, as the area associated with basins changes. You iterate in order of increasing time, not increasing height (e.g. using a heap with decrease-key operation). Once the final pair of basins have equal height, you are done; afterwards there is only a single basin left.

在整体,这给你的有趣的时候,那里的东西根本改变的序列。在这之间,问题将更加地方,因为你只需要考虑一个盆的形状来计算它的水位。在这个局部问题,你的知道的水包含在该流域的体积,这样你就可以如使用二分法来找到一个合适的水平,这一点。相邻的有趣的时间可能会为你的二分法提供有用的终点。

On the whole, this gives you a sequence of "interesting" times, where things change fundamentally. In between these, the problem will be much more local, as you only have to consider the shape of a single basin to compute its water level. In this local problem, you know the volume of water contained in that basin, so you can e.g. use bisection to find a suitable level for that. The adjacent "interesting" times might provide useful end points for your bisection.

要计算出一个三角形多面体的量,你可以使用一个3D版在鞋带公式:在每一个三角形,你把它的三个顶点,并计算它们的决定因素。总结起来,并用6分,和你有封闭空间的体积。请确保您定向所有三角形一致,由内而外,即要么全部看到或从外面所有的观察。选择决定整个标志,尝试一下,看看哪个是哪个。

To compute the volume of a triangulated polytope, you can use a 3D version of the shoelace formula: for every triangle, you take its three vertices and compute their determinant. Sum them up and divide by 6, and you have the volume of the enclosed space. Make sure that you orientate all your triangles consistently, i.e. either all as seen from the inside or all as seen from the outside. The choice decides the overall sign, try it out to see which one is which.

请注意,您的问题可能需要细化:当一个流域水平达到两次鞍点的完全一样的高度的,在哪里呢水流?如果没有流体模拟,这是不明确的,我猜。你可以说,它应该平均分配所有相邻的盆地之一。你可以说,这样的情况是不可能发生的真实数据,因此选择一个邻居随意,这意味着这鞍点具有比其他的高无穷小。或者,你能想出一些其他的解决方案。如果这种情况下是你的兴趣,那么你可能需要弄清楚你希望有什么。

Note that your question might need refinement: when the level in a basin reaches two saddle points at exactly the same height, where does the water flow? Without fluid simulation this is not well defined, I guess. You could argue that it should be distributed equally among all adjacent basins. You could argue that such situations are unlikely to occur in real data, and therefore choose one neighbour arbitrarily, implying that this saddle point has infinitesimally less height than the other ones. Or you could come up with a number of other solutions. If this case is of interest to you, then you might need to clarify what you expect there.