//--------------------------------------------------------------------- QuadNode <A> newQuadNode(_eQuadTreeLeaf leaf, QuadNodeObjectFactory <A> node_object_factory) { QuadNode <A> node = new QuadNode <A>(); node.create(mDepth + 1, mQuadTree, (A)mArea.getArea(leaf), node_object_factory); return(node); }
//--------------------------------------------------------------------- public IArea getArea(_eQuadTreeLeaf leaf) { float half_size_x = mSize.x * 0.5f; float half_size_y = mSize.y * 0.5f; EbVector3 half_size = mSize * 0.5f; switch (leaf) { case _eQuadTreeLeaf.UR: return new RectArea(mOrigin + new EbVector3(half_size_x, half_size_y, 0), half_size); case _eQuadTreeLeaf.UL: return new RectArea(mOrigin + new EbVector3(0, half_size_y, 0), half_size); case _eQuadTreeLeaf.LL: return new RectArea(mOrigin, half_size); default://LR return new RectArea(mOrigin + new EbVector3(half_size_x, 0, 0), half_size); } }
//--------------------------------------------------------------------- public IArea getArea(_eQuadTreeLeaf leaf) { float half_size_x = mSize.x * 0.5f; float half_size_y = mSize.y * 0.5f; EbVector3 half_size = mSize * 0.5f; switch (leaf) { case _eQuadTreeLeaf.UR: return(new RectArea(mOrigin + new EbVector3(half_size_x, half_size_y, 0), half_size)); case _eQuadTreeLeaf.UL: return(new RectArea(mOrigin + new EbVector3(0, half_size_y, 0), half_size)); case _eQuadTreeLeaf.LL: return(new RectArea(mOrigin, half_size)); default: //LR return(new RectArea(mOrigin + new EbVector3(half_size_x, 0, 0), half_size)); } }