Visvalingam-Whyatt折线简化算法澄清折线、算法、Visvalingam、Whyatt

2023-09-11 04:47:01 作者:神都救不了妳

我想实现一个折线简化算法。原来的文章可以在这里找到: http://archive.is/Tzq2 。这看起来非常简单的概念,但我不明白的采样算法(我认为这是措辞不当)伪code供给,并希望有人能提供一些见解。从文章中,我得知的基本思路是,以

I'm trying to implement a polyline simplification algorithm. The original article can be found here: http://archive.is/Tzq2. It seems straightforward in concept but I don't understand the sample algorithm (I think it's poorly worded) pseudocode supplied and was hoping someone could provide some insight. From the article, I gathered that the basic idea is to

在每个点计算有效面积(由一行三连冠点之间的三角形成的),并删除那些有0面积 具有最小面积开始,与阈值进行比较的点的区域,并且如果该区域是低于该阈值时,从折线删除。 将相邻的两个点,并重新计算自己的领域,因为他们已经改变了 回到2到下阈值的所有点的区域已被删除

该算法如下(逐字从文章中复制):

The algorithm is as follows (copied verbatim from the article):

计算各点的有效面积 删除所有点零区,并将其存储在一个单独的列表与该领域 REPEAT 找到用最少的有效面积的点,并把它称为当前点。如果它的计算出的面积小于最后一个点的被淘汰,使用后者的面积代替。 (这确保了当前点不能而不消除previously消除点消除。) 删除从原始列表的当前点,这与它的相关联的区域添加到新的列表一起,使得线可以在运行时被过滤。 重新计算的两个相邻点的有效区域(参见图1b)。 Compute the effective area of each point Delete all points with zero area and store them in a separate list with this area REPEAT Find the point with the least effective area and call it the current point. If its calculated area is less than that of the last point to be eliminated, use the latter's area instead. (This ensures that the current point cannot be eliminated without eliminating previously eliminated points.) Delete the current point from the original list and add this to the new list together with its associated area so that the line may be filtered at run time. Recompute the effective area of the two adjoining points (see Figure 1b). 原线由仅2个点,即起点和终点。

我很困惑,在重复下的第一个步骤中的'如果'条款等任何人都可以澄清?

I'm confused with the 'if' clause in the first step under 'REPEAT'... could anyone clarify?

推荐答案

该算法的本质是排名根据其重要性分。的点的意义是由它的有效面积近似。

The essence of the algorithm is ranking of points by their significance. Significance of the point is approximated by its effective area.

假设你已经消除了A点,然后重新计算B点的有效面积的新领域可以更大的或更小的的比旧的。它可以比A的有效面积然而越小,算法仍然认为乙作为比A更显著

Suppose you have eliminated Point A and then recalculated the effective area of Point B. The new area can be larger or smaller than the old one. It can be smaller than the effective area of A. However, the algorithm still views B as more significant than A.

如果条款的目的是为了确保B点比在最后的名单更显著,仅此而已。

The purpose of the if clause is to ensure that Point B is more significant than A in the final list, that's all.