哪个算法可以高效地找到一组点的路径的一定距离内? [英] Which algorithm can efficiently find a set of points within a certain distance of a path?

查看:159
本文介绍了哪个算法可以高效地找到一组点的路径的一定距离内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定一组点的取值的(一组的x,y坐标),以及由线段连接的一组点的升的路径的,描述一种有效的算法,可以被用来查找点与取值的那些路径的指定距离的ð的内的的一个子集

Given a set of points s (a set of x,y coordinates) and a path that is made up of line segments joining a set of points l, describe an efficient algorithm that can be used to find a subset of points from s that are within the specified distance d of the path l.

这方面的一个实际应用中可能会找到餐馆列表中10英里任何位置一个客场之旅的路径之间的引用。

A practical application of this may be to find a list of restaurants within 10 miles anywhere along a road trip path between cites.

例如,在下面的图中,在绿色的点将被包括在搜索结果中。

For example, in the following diagram, the points in green would be included in the search results.

解决方案将pferred在C#$ P $,但加分的可​​能了基于SQL的方法给出: - )

Solutions would be preferred in C#, but bonus points may be given for a SQL based approach :-)

推荐答案

我也是前段时间想到这个问题。我认为,有效率是一种误导。只是测试所有线段的每个点是不够好。这是很便宜计算距离。 如果有很多点,你也可以考虑一下炼指向使用水平集的方法来选择策略。即。

I also thought about this some time ago. I think, efficient is misleading. Just testing all line segments for each point is good enough. It is very cheap to calculate the distance. If there are many points, you can also think about refining the strategy which points to choose using a level-set approach. i.e.

  • 走线沿线,步长2倍要检查(多还是少?),并创建人工点是近的距离。
  • itereate:挑选各地点的新点是近(不计算一个eucledian距离,仅有1规范和简单的测试x和y坐标) - 然后测试它们之间的距离(你甚至可以继承的具体从人工指向发现近点线段,然后选择一个先进行测试,但将搜索范围扩大,因为有可能是曲折!)

这也许不是完整的,而应该是快速,避免了检查点远,很确定。

that's maybe not complete, but should be fast and avoids checking points far away and quite ok.

这篇关于哪个算法可以高效地找到一组点的路径的一定距离内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆