30#define NAMED_RTREE_QUAL RTree<Named*, Named, float, 2, Named::StoringVisitor>
33inline float NAMED_RTREE_QUAL::RectSphericalVolume(Rect* a_rect) {
35 const float extent0 = a_rect->m_max[0] - a_rect->m_min[0];
36 const float extent1 = a_rect->m_max[1] - a_rect->m_min[1];
37 return .78539816f * (extent0 * extent0 + extent1 * extent1);
41inline NAMED_RTREE_QUAL::Rect NAMED_RTREE_QUAL::CombineRect(Rect* a_rectA, Rect* a_rectB) {
42 ASSERT(a_rectA && a_rectB);
44 newRect.m_min[0] =
rtree_min(a_rectA->m_min[0], a_rectB->m_min[0]);
45 newRect.m_max[0] =
rtree_max(a_rectA->m_max[0], a_rectB->m_max[0]);
46 newRect.m_min[1] =
rtree_min(a_rectA->m_min[1], a_rectB->m_min[1]);
47 newRect.m_max[1] =
rtree_max(a_rectA->m_max[1], a_rectB->m_max[1]);
79 void Insert(
const float a_min[2],
const float a_max[2],
Named*
const& a_data) {
80 NAMED_RTREE_QUAL::Insert(a_min, a_max, a_data);
90 void Remove(
const float a_min[2],
const float a_max[2],
Named*
const& a_data) {
91 NAMED_RTREE_QUAL::Remove(a_min, a_max, a_data);
99 NAMED_RTREE_QUAL::RemoveAll();
113 return NAMED_RTREE_QUAL::Search(a_min, a_max, c);
Allows to store the object; used as context while traveling the rtree in TraCI.
Base class for objects which have an id.
A RT-tree for efficient storing of SUMO's Named objects.
void Remove(const float a_min[2], const float a_max[2], Named *const &a_data)
Remove entry.
void Insert(const float a_min[2], const float a_max[2], Named *const &a_data)
Insert entry.
int Search(const float a_min[2], const float a_max[2], const Named::StoringVisitor &c) const
Find all within search rectangle.
void RemoveAll()
Remove all enrties.