
第1页 / 共5页

第2页 / 共5页

第3页 / 共5页

第4页 / 共5页

第5页 / 共5页





Title:
* *Description:
* *Copyright: Copyright (c) 2010
* *Company:
* * @author An Zhiqiang (Email: 343887157@qq.com) * @version 1.0 (上午 11:34:06 2010) */ public class QuadTreeNode { NW = 0,NE = 1,SW = 2,SE = 3; public static final int NODE_NUMS = 4; public static final int /* * a quadrant defined below: * * * */ public int[] rect;// x,y,w,h public Vector vec; public QuadTreeNode[] node = new QuadTreeNode[NODE_NUMS]; -----------|----------- NW(0) | NE(1) SW(2) | SE(3) public QuadTreeNode(int x, int y, int w, int h) { init(x, y, w, h); } public QuadTreeNode() { } public void init(int x, int y, int w, int h) { int[] rect = new int[4]; rect[NW] = x; rect[NE] = y; rect[SW] = w; rect[SE] = h; this.rect = rect; vec = new Vector(); }Title:
* *Description:
* *Copyright: Copyright (c) 2010
Company:
* * @author An Zhiqiang (Email: 343887157@qq.com) * @version 1.0 (上午 11:34:35 2010) */ public class Util { /** * return true if rectA is inside rectB; * @param rectA * @param rectB */ public static boolean isInsideRect(int[] rectA,int[] rectB){ if(rectA[0]>rectB[0] && (rectA[0]+rectA[2])< (rectB[0]+rectB[2]) &&rectA[1]>rectB[1] && (rectA[1]+rectA[3])< (rectB[1]+rectB[3])){ return true; }else { return false; } } public static boolean isOverLapped(int[] rectA,int[] rectB){ if( rectA[0]+rectA[2]Title:
*Description:
* *Copyright: Copyright (c) 2010
* *Company:
* * @author An Zhiqiang (Email: 343887157@qq.com) * @version 1.0 (上午 11:34:15 2010) */ public class QuadTree { public QuadTreeNode root; public int depth; public int maxDepth; public QuadTree(int[] rect, int maxDepth) { depth = 0; this.maxDepth = maxDepth; root = new QuadTreeNode(); root.init(rect); } /* inserts a node into quadtree and return pointer to new node */ public QuadTreeNode insert(Object node_key, int[] rect) { depth = -1; debugNum = 0; return root.insertNode(this, rect, node_key); } /* searches nodes inside search_box */ void search(int[] search_box, Vector results_list) { root.searchNodes(search_box, results_list); } public static int debugNum; }
2023年江西萍乡中考道德与法治真题及答案.doc
2012年重庆南川中考生物真题及答案.doc
2013年江西师范大学地理学综合及文艺理论基础考研真题.doc
2020年四川甘孜小升初语文真题及答案I卷.doc
2020年注册岩土工程师专业基础考试真题及答案.doc
2023-2024学年福建省厦门市九年级上学期数学月考试题及答案.doc
2021-2022学年辽宁省沈阳市大东区九年级上学期语文期末试题及答案.doc
2022-2023学年北京东城区初三第一学期物理期末试卷及答案.doc
2018上半年江西教师资格初中地理学科知识与教学能力真题及答案.doc
2012年河北国家公务员申论考试真题及答案-省级.doc
2020-2021学年江苏省扬州市江都区邵樊片九年级上学期数学第一次质量检测试题及答案.doc
2022下半年黑龙江教师资格证中学综合素质真题及答案.doc