⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quadtree.as

📁 Papervision3d的源码
💻 AS
字号:
package org.papervision3d.core.data.qTree {		import flash.geom.Point;	import flash.geom.Rectangle;	import org.papervision3d.core.math.util.FastRectangleTools;			/**	 * @Author Ralph Hauwert	 * 	 */	public class QuadTree	{		public var baseNode:QuadTreeBaseNode;				public function QuadTree(width:Number, height:Number, maxDepth:int = 6)		{			baseNode = new QuadTreeBaseNode(width,height,maxDepth);		}				public function insertItem(item:QuadTreeItem):Boolean		{			if(FastRectangleTools.intersects(item.rectangle, baseNode.boundingRectangle)){				if(baseNode.boundingRectangle.containsRect(item.rectangle)){					//It falls within the quadtree, cool..back to normal..					baseNode.insertItem(item);				}else{					//It doesn't fall within the tree, but it does intersect, let's clip the items rectangle.					item.clipRectangleWith(baseNode.boundingRectangle);					//And insert					baseNode.insertItem(item);				}			}			//It doesn't even intersect...exit...			return false;		}				public function queryRectangle(rectangle:Rectangle):Array		{			var array:Array = new Array();			baseNode.queryRectangle(rectangle, array);			return array;		}				public function queryPoint(point:Point):Array		{			var array:Array = new Array();			baseNode.queryPoint(point, array);			return array;		}				public function clearItems():void		{			baseNode.clearItems();		}			}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -