---
title: "Discussion on \"使用四叉树优化碰撞检查\" | Hashnode"
description: "Discussion on \"使用四叉树优化碰撞检查\". 前情提要\n大概是初中吧，我当时在给游戏开发模组，做了个界面，界面中面板之间要求不能堆叠，因为堆叠后不好处理点击事件等，我当时是通过遍历所有的面板去判断的，后来才知道可以用四叉树优化类似的需求。\n还是得说一句，四叉树确实能优化这个需求，但提升不一定会明显，毕竟四叉树的时间复杂度是 logN，和 N 相比，只有在数据量大的时候才会有明显效果。\n四叉树\n那么四叉树是怎么提升效率的呢？先看一下原本的实现：\nfunction intersects (range, cur) {\n    return !(\n..."
url: "https://hashnode.com/posts/5l255so5zub5yj5qcr5lyy5yyw56kw5pke5qoa5pl/663b13a414878b4e9243ee54"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [使用四叉树优化碰撞检查](https://erio.hashnode.dev/5l255so5zub5yj5qcr5lyy5yyw56kw5pke5qoa5pl?utm_source=hashnode&utm_medium=feed)

前情提要 大概是初中吧，我当时在给游戏开发模组，做了个界面，界面中面板之间要求不能堆叠，因为堆叠后不好处理点击事件等，我当时是通过遍历所有的面板去判断的，后来才知道可以用四叉树优化类似的需求。 还是得说一句，四叉树确实能优化这个需求，但提升不一定会明显，毕竟四叉树的时间复杂度是 logN，和 N 相比，只有在数据量大的时候才会有明显效果。 四叉树 那么四叉树是怎么提升效率的呢？先看一下原本的实现： function intersects (range, cur) { return !( ...

May 8, 2024 · 4 min read · erio.hashnode.dev  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#quadtree](https://hashnode.com/tag/quadtree)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#2articles1week](https://hashnode.com/tag/2articles1week)

## Written by

[Erioifpud](https://hashnode.com/@Erioifpud)

@Erioifpud

  
[View profile](https://hashnode.com/@Erioifpud)

Development

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
