一文了解M-Tree(M树)

本文深入解析M-Tree,一种用于解决最近邻搜索和范围搜索问题的空间索引结构。内容涵盖M-Tree的背景、核心思路、结构、插入过程、分裂过程以及如何进行范围搜索。M-Tree利用圆形覆盖空间区域,减少搜索数据量,提高查询效率。
摘要由CSDN通过智能技术生成

概括

这篇博客分析了论文Indexing Metric Spaces with M-tree(后文简称M-Tree或M树),我将从以下几个方面介绍它:

  1. 背景
  2. M-Tree的结构
  3. M-Tree的插入
  4. M-Tree的分裂
  5. 如何使用M-Tree进行range搜索
  6. M-Tree的代码

背景

M-tree被设计为了解决最近邻搜索问题(NN)或范围搜索问题。以生活中的例子作为说明,最近邻搜索问题(NN)指的是,给定一个地理位置,在数据集中找到距离给定位置最近的目标(比如最近的饭店,最近的银行等等)。
范围搜索问题指的是,给定一个地理位置和搜索范围,在数据集中找到距离小于范围的所有目标。

M-Tree核心思路

M-tree使用圆形(二维情况)覆盖空间区域。每个圆涵盖了一部分数据所在的区域。对于查询目标,M-tree确定哪个圆和目标区域相交,若相交,则继续探测对应的圆。若不相交则滤除对应的圆,这意味着该圆涵盖的数据都不需要进行判断,减少了需要探测的数据量。本质上,M-tree从上到下就是一个大圆包含小圆的结构。
在这里插入图片描述

M-Tree的结构

在这一节分析如果构建M-tree。M-Tree使用圆来划分区域,因此每个结点存在一个圆心和一个半径。M-Tree的分为两类结点:内结点,叶结点。每个结点存储0~M个孩子结点。每个结点的多个属性我们用一个entry类来组织,不同类型的结点entry类是不同的:

内节点:它是包含了

  • entry ⁡ ( O r ) = [ O r , ptr ⁡ ( T ( O r ) ) , r ( O r ) , d ( O r , P ( O r ) ) ] \operatorname{entry}\left(O_{r}\right)=\left[O_{r}, \operatorname{ptr}\left(T\left(O_{r}\right)\right), r\left(O_{r}\right), d\left(O_{r}, P\left(O_{r}\right)\right)\right] entry(Or)=[Or,ptr(T(Or)),r(Or),d(Or,P(Or))]

O r O_r Or是结点圆心值,

Mtree is a powerful tree creation tool for the Unity editor. Nominated for best Artistic Tool 2019 Unity Awards. Every game needs vegetation, and while there are numerous vegetation packs for sale on the asset store, nothing beats the usefulness of having total control over the look and performance of the assets. Mtree will not only create beautiful looking vegetation, it will streamline your workflow by removing the need of modelling, unwrapping, importing your vegetation models from another software, and doing it all over again when you need to change a small detail. With Mtree, there will be less iterations over your models, and they will be quicker. Mtree trees are made in unity, for unity, the material is right, the dimensions are right, and everything is simple. Moreover, a good mesh is not enough in order to have a believable vegetation asset, you need a good shader, a good wind displacement solution, and vertex data to feed those; Mtree will answer every one of these needs. Mtree offers an intuitive, simple, yet complete solution for crafting AAA trees in a matter of minutes. With Mtree you can: • Create a trunk of any shape. • Add branches, grow them, split stem, add more branches. • Add leafs of any shape. • Bake the ambient occlusion in the vertex data. • Control the polygon count, get the most out of the fewest triangles. • Create Branches textures from a single leaf texture with the Branch Editor. • Save your finished tree as a prefab that is convenient to use. What Mtree will do for you: • Automatically create LOD levels. • Create and assign materials to the bark and leaves of your trees. • Make branches react to the colliders of your scene. • Create and render a billboard when you save the tree as prefab. • Bake the ambient occlusion when you save the tree as prefab. • Create vertex color data that will be used to drive the wind simulation and random color variation.
参考资源链接:[Python库tree_sitter最新版本发布](https://wenku.csdn.net/doc/4e9oti8rdo?utm_source=wenku_answer2doc_content) 为了在macOS Mojave上安装名为tree_sitter-0.0.8-cp37-cp37m-macosx_10_14_x86_64.whl的Python wheel包,首先需要确保你的系统中已经安装了Python环境和pip工具。以下是详细步骤: 1. 打开终端,更新pip至最新版本,以避免兼容性问题: ```bash python3 -m pip install --upgrade pip ``` 2. 安装wheel,如果尚未安装,因为wheel是使用pip安装Python包的依赖工具: ```bash pip3 install wheel ``` 3. 使用pip安装wheel文件,确保使用正确的文件名和路径: ```bash pip3 install /path/to/tree_sitter-0.0.8-cp37-cp37m-macosx_10_14_x86_64.whl ``` 替换`/path/to/`为wheel文件实际存放的目录路径。如果该文件位于当前目录下,可以使用`.`来表示当前目录。 4. 安装完成后,你可以在Python环境中导入tree_sitter库并使用它进行语法解析和操作。例如: ```python import tree_sitter parser = tree_sitter.Parser() parser.set_language(tree_sitter.PYTHON) tree = parser.parse(bytes_of_python_code) root_node = tree.root_node # 接下来可以遍历语法或进行其他操作 ``` 5. 如果你在使用tree_sitter过程中遇到任何问题,可以参考官方文档或《Python库tree_sitter最新版本发布》一文,后者提供了tree_sitter库的最新特性介绍以及可能的常见问题解答。 6. 一旦tree_sitter库安装成功并正确运行,它将为你的Python程序提供强大的语法解析能力,特别是在需要实时语法分析的编辑器插件和编程工具中。 在你成功掌握了tree_sitter库的安装和基本使用后,为了进一步提升你在使用tree_sitter进行项目开发时的效率和能力,建议深入学习tree_sitter提供的高级功能和API,你可以参考相关的高级教程或技术论坛上的讨论。 参考资源链接:[Python库tree_sitter最新版本发布](https://wenku.csdn.net/doc/4e9oti8rdo?utm_source=wenku_answer2doc_content)
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值