本文介绍了快速查找网格和网格之间的交点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何,我可以找到线条和网格之间的所有交点吗? (我知道交点圆圈不是按比例绘制的)



蛮力方法是计算 xy grid,但是这个算法非常低效( O(m * n),其中 m x 格的数量, n y grid)。



我正在寻找一个更好的算法。

解决方案

我不确定我真的明白这个问题。这是你想要的任何机会吗?






Is there anyway that allows me to find all the intersection points between a line and a grid? ( The intersection circles are not drawn to scale with each other, I know)

A brute force way is to compute very intersection for the x-y grid with the line, but this algorithm is awfully inefficient (O(m*n), where m is the number of x grid and n is the number of y grid).

I'm looking for a better algorithm on this.

解决方案

I'm not sure I really understand the question. Is this what you're looking for by any chance?

Illustration 1 http://i31.tinypic.com/mwwg37.png

Illustration 2 http://i27.tinypic.com/657uc1.png

这篇关于快速查找网格和网格之间的交点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 10:32