game-ai/src/main/java/com/jzy/game/ai/quadtree/polygon/PolygonGuadTree.java
/**
	 * Inserts a point into the tree, updating the tree's structure if necessary.
	 * 
	 * @param {.QuadTree.Node}
	 *            parent The parent to insert the point into.
	 * @param {QuadTree.Point}
	 *            point The point to insert.
	 * @return {boolean} True if a new node was added to the tree; False if a node
	 *         already existed with the correpsonding coordinates and had its value
	 *         reset.
	 * @private
	 */
Inserts a point into the tree, updating the tree's structure if necessary.

@param {.QuadTree.Node}
parent The parent to insert the point into.
@param {QuadTree.Point}
point The point to insert.
@return {boolean} True if a new node was added to the tree; False if a node
already existed with the correpsonding coordinates and had its value
reset.
@private
Inserts a point into the tree updating the tree ' s structure if necessary . @param { . QuadTree . Node } parent The parent to insert the point into . @param { QuadTree . Point } point The point to insert . @return { boolean } True if a new node was added to the tree ; False if a node already existed with the correpsonding coordinates and had its value reset . @private
private boolean insert(Node<Polygon> parent, PointData<Polygon> point) {
		Boolean result = false;
		switch (parent.getNodeType()) {
		case EMPTY:
			this.setPointForNode(parent, point);
			result = true;
			break;
		case LEAF:
			List<Data<Polygon>> datas = parent.getDatas();
			if (datas.size() < items || parent.getDepth() >= depth) {
				if (datas.contains(point)) {
					return false;
				}
				this.setPointForNode(parent, point);
				result = true;
			} else {
				this.split(parent);
				result = this.insert(parent, point);
			}
			break;
		case POINTER:
			List<Node<Polygon>> nodes = this.getQuadrantForPolygon(parent, point.getValue());
			for (Node<Polygon> n : nodes) {
				if (this.insert(n, point)) {
					result = true;
				}
			}
			break;
		default:
			throw new QuadTreeException("Invalid nodeType in parent");
		}
		return result;
	}
private boolean insert ( Node < Polygon > parent , PointData < Polygon > point ) { Boolean result = false ; switch ( parent . getNodeType ( ) ) { case EMPTY : this . setPointForNode ( parent , point ) ; result = true ; break ; case LEAF : List < Data < Polygon > > datas = parent . getDatas ( ) ; if ( datas . size ( ) < items || parent . getDepth ( ) >= depth ) { if ( datas . contains ( point ) ) { return false ; } this . setPointForNode ( parent , point ) ; result = true ; } else { this . split ( parent ) ; result = this . insert ( parent , point ) ; } break ; case POINTER : List < Node < Polygon > > nodes = this . getQuadrantForPolygon ( parent , point . getValue ( ) ) ; for ( Node < Polygon > n : nodes ) { if ( this . insert ( n , point ) ) { result = true ; } } break ; default : throw new QuadTreeException ( "Invalid nodeType in parent" ) ; } return result ; }
Inserts a point into the tree, updating the tree's structure if necessary.
Inserts a point into the tree updating the tree ' s structure if necessary .
// 未插满或者到达最大深度，直接加入
