MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / insert

Method insert

utilities/olcUTIL_QuadTree.h:269–281  ·  view source on GitHub ↗

Inserts an item into the quadtree

Source from the content-addressed store, hash-verified

267
268 // Inserts an item into the quadtree
269 typename IQuadtreeContainer::iterator insert(const T& item, const geom2d::rect<CTYPE>& itemsize)
270 {
271 QuadTreeItem<T> newItem;
272 newItem.item = item;
273
274 // Item i stored in container
275 m_allItems.emplace_back(newItem);
276
277 // Pointer/Area of item is stored in geom2d::rect<CTYPE> tree
278 m_allItems.back().pItem = root.insert(std::prev(m_allItems.end()), itemsize);
279
280 return std::prev(m_allItems.end());
281 }
282
283 // Returns a std::list of pointers to items within the search area
284 std::list<typename IQuadtreeContainer::iterator> search(const geom2d::rect<CTYPE>& rArea) const

Callers

nothing calls this directly

Calls 2

endMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected