C# 中点的统一网格细分

发布于 2024-09-19 12:47:46 字数 193 浏览 0 评论 0原文

我有一组 P 的 2D 点,我可以将其聚集在 2D 均匀间隔的网格中,其中每个单元格的长度为 X。

我想这样做是因为我正在尝试创建热图,并且我有很多信息所以我希望通过将点聚集到均匀间隔的网格中,我可以报告每个网格的最终计数。

谢谢!

如果有什么区别的话,我将在细分之前首先通过 SQL(点)获取位于指定点的特定半径内的信息。

I have a set P of 2D points that I could like to cluster in a 2D uniformly spaced grid, where each cell is length X.

I want to do this because I am trying to create a heat map, and I have way to much information so I am hoping by clustering the points into a uniformly spaced grid I can just report the final count of each grid.

Thanks!

if It makes any difference I am getting my information via SQL (the points) that are within a certain radius of a specified point first prior to subdivision.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不交电费瞎发啥光 2024-09-26 12:47:46

您在寻找这样的东西吗?

var result = from p in points
              group p by new { X = p.X / length, Y = p.Y / length } into g
              select new
              {
                  g.Key.X,
                  g.Key.Y,
                  Count = g.Count()
              };

我不知道是否有办法利用点的顺序

Are you looking for something like this?

var result = from p in points
              group p by new { X = p.X / length, Y = p.Y / length } into g
              select new
              {
                  g.Key.X,
                  g.Key.Y,
                  Count = g.Count()
              };

I don't know if there's a way to take advantage of the order of points.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文