Tesseral aithmetic /四叉树 [英] Tesseral aithmetic/quadtree

查看:214
本文介绍了Tesseral aithmetic /四叉树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个项目,与四叉树寻路而回,我想提高它的性能。看来使用tesseral算术来确定节点邻接(按照此页面,英属哥伦比亚大学)地理系的礼貌会比蛮力方法,我目前使用的(我检查共享边,其工作方式快得多罚款静态四叉树,但将太多的开销,如果地图正在发生变化)。
我或多或少地了解发生了什么的邻接算法段说,但我真的不知道如何开始。我在C#中主要有兴趣,但它会是真棒,如果有已经有一些源左右浮动与tesseral算术,我可以看到,无论何种语言的工作。否则,任何人都可以给我处理增加了一些三分球/减载?

I did a project a while back on pathfinding with quadtrees and I would like to improve on its performance. It seems that using tesseral arithmetic to determine node adjacency (as per this page, courtesy of the Geography department of the University of British Columbia) would be much faster than the brute force method I'm using at the moment (I'm checking for shared edges, which works fine for a static quadtree but would be too much overhead if the map were changing). I more or less understand what's said in the Adjacency Algorithm section, but I'm not really sure how to begin. I'm primarily interested in C#, but it'd be awesome if there's already some source floating around for working with tesseral arithmetic that I could look at, regardless of language. Otherwise, could anyone give me some pointers on dealing with the addition/subtraction carries?

推荐答案

我认为,对付tesseral算术的最简单的方法就是位解压的数字,通常执行任意数量的算术运算,并以位拉链他们回来时,需要tesseral形式:

I think, the easiest way to deal with tesseral arithmetic is to "bit-unzip" numbers, perform any number of arithmetical operations normally, and "bit-zip" them back when tesseral form is needed:

z = bit_zip(bit_unzip(x) + bit_unzip(y));

(此示例为无符号仅对于有符号整数,解压缩每个号码分成两个变量,做常规的算术上的两部分分开)。

(This example works for unsigned only. For signed integers, unpack each number into two variables and do normal arithmetic on both parts separately).

您可以找到在位解压和位拉链快速实施计算的事项
,章节1.15逐位拉链。

You can find fast implementations for "bit-unzip" and "bit-zip" in "Matters Computational ", chapter 1.15 "Bit-wise zip".

这篇关于Tesseral aithmetic /四叉树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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