17 #if !defined(OPENNURBS_RTREE_INC_)
18 #define OPENNURBS_RTREE_INC_
57 #define ON_RTree_MIN_NODE_COUNT 2
58 #define ON_RTree_MAX_NODE_COUNT 6
158 struct ON_RTreeListNode* AllocListNode();
159 void FreeListNode(
struct ON_RTreeListNode* list_node);
161 void DeallocateAll();
167 size_t SizeOf()
const;
173 size_t SizeOfUnusedBuffer()
const;
186 struct Blk* m_list_nodes;
189 unsigned char* m_buffer;
190 size_t m_buffer_capacity;
192 struct Blk* m_blk_list;
195 ON_MEMORY_POOL* m_heap;
196 size_t m_sizeof_heap;
246 bool Initialize(
const class ON_RTree& a_rtree);
362 enum { MAX_STACK = 32 };
370 bool PushChildren(
struct StackElement* sp,
bool bFirstChild);
372 StackElement m_stack[MAX_STACK];
381 ON_RTree( ON_MEMORY_POOL* heap = 0,
size_t leaf_count = 0 );
393 bool CreateMeshFaceTree(
const class ON_Mesh* mesh );
414 bool Insert(
const double a_min[3],
const double a_max[3],
void* a_element_id);
415 bool Insert(
const double a_min[3],
const double a_max[3],
int a_element_id);
416 bool Insert2d(
const double a_min[2],
const double a_max[2],
void* a_element_id);
417 bool Insert2d(
const double a_min[2],
const double a_max[2],
int a_element_id);
438 bool Remove(
const double a_min[3],
const double a_max[3],
void* a_elementId);
439 bool Remove(
const double a_min[3],
const double a_max[3],
int a_elementId);
440 bool Remove2d(
const double a_min[2],
const double a_max[2],
void* a_elementId);
441 bool Remove2d(
const double a_min[2],
const double a_max[2],
int a_elementId);
495 bool ON_MSC_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
501 bool ON_MSC_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
507 bool ON_MSC_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
533 const double a_plane_eqn[4],
536 bool ON_MSC_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
540 bool Search(
const double a_min[3],
const double a_max[3],
541 bool ON_MSC_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
void* a_context
544 bool Search(
const double a_min[3],
const double a_max[3],
548 bool Search(
const double a_min[3],
const double a_max[3],
552 bool Search(
const double a_min[3],
const double a_max[3],
556 bool Search(
const double a_min[3],
const double a_max[3],
560 bool Search2d(
const double a_min[2],
const double a_max[2],
561 bool ON_MSC_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
void* a_context
564 bool Search2d(
const double a_min[2],
const double a_max[2],
568 bool Search2d(
const double a_min[2],
const double a_max[2],
572 bool Search2d(
const double a_min[2],
const double a_max[2],
576 bool Search2d(
const double a_min[2],
const double a_max[2],
620 void ON_MSC_CDECL resultCallback(
void* a_context, ON__INT_PTR a_idA, ON__INT_PTR a_idB),
644 bool ON_MSC_CDECL resultCallback(
void* a_context, ON__INT_PTR a_idA, ON__INT_PTR a_idB),
673 size_t SizeOf()
const;
683 void ReInsert(
ON_RTreeNode*,
struct ON_RTreeListNode**);
ON_RTreeBranch m_branch[ON_RTree_MAX_NODE_COUNT]
bool IsInternalNode() const
struct ON_RTreeNode * m_child