折线简化
Polyline simplification
我正在尝试理解 this 代码。
据我了解,代码试图根据公差细化几何图形。基本上它检查两点之间的距离是否小于公差,并相应地 retains/removes 点。
不过我有一个疑问。点采用经纬度格式。该代码只是计算欧几里德距离的平方(我们都知道的简单平方公式)。这不是一种错误的方法吗,因为基于经纬度的距离不同于欧氏距离?
二、公差的单位是什么?在这个 test 中,使用了容差值 5。这个值如何适合这里?
What I understand is that code tries to refine the geometry based on tolerance. Basically it checks if distance between two points is less than tolerance or not, and retains/removes the points accrdingly.
是的,这是第一步,在第二步中,它会尝试找到(基本上)对齐的连续行并合并它们。
I have a query though. Points are in lat-long format. Code simply calculates square of the Euclidean distance(simple square formula we all know). Isn't this a wrong approach as lat-long based distance are different from Euclidean distance?
(c) 2017, Vladimir Agafonkin
Simplify.js, a high-performance JS polyline simplification library
该代码未声称适用于 lat-lng 坐标。尽管它们看起来像 2d 坐标,但它们代表 3d 中的点 space;我没有看到代码是为此制作的。
另一方面,重写为3d-space应该不会太复杂。然后您所要做的就是将 lat-lng 点转换为 3d-coordiantes
Second, what is the unit of tolerance? In test, tolerance value of 5 is used. How does this value fit in here?
像素,英里,无所谓。与您通过的分数相同的单位。
我正在尝试理解 this 代码。
据我了解,代码试图根据公差细化几何图形。基本上它检查两点之间的距离是否小于公差,并相应地 retains/removes 点。
不过我有一个疑问。点采用经纬度格式。该代码只是计算欧几里德距离的平方(我们都知道的简单平方公式)。这不是一种错误的方法吗,因为基于经纬度的距离不同于欧氏距离?
二、公差的单位是什么?在这个 test 中,使用了容差值 5。这个值如何适合这里?
What I understand is that code tries to refine the geometry based on tolerance. Basically it checks if distance between two points is less than tolerance or not, and retains/removes the points accrdingly.
是的,这是第一步,在第二步中,它会尝试找到(基本上)对齐的连续行并合并它们。
I have a query though. Points are in lat-long format. Code simply calculates square of the Euclidean distance(simple square formula we all know). Isn't this a wrong approach as lat-long based distance are different from Euclidean distance?
(c) 2017, Vladimir Agafonkin
Simplify.js, a high-performance JS polyline simplification library
该代码未声称适用于 lat-lng 坐标。尽管它们看起来像 2d 坐标,但它们代表 3d 中的点 space;我没有看到代码是为此制作的。
另一方面,重写为3d-space应该不会太复杂。然后您所要做的就是将 lat-lng 点转换为 3d-coordiantes
Second, what is the unit of tolerance? In test, tolerance value of 5 is used. How does this value fit in here?
像素,英里,无所谓。与您通过的分数相同的单位。