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 127 inline bool IsInternalNode()
const 128 {
return (m_level > 0); }
129 inline bool IsLeaf()
const 130 {
return (m_level == 0); }
162 struct ON_RTreeListNode* AllocListNode();
163 void FreeListNode(
struct ON_RTreeListNode* list_node);
165 void DeallocateAll();
171 size_t SizeOf()
const;
177 size_t SizeOfUnusedBuffer()
const;
188 struct Blk* m_nodes =
nullptr;
190 struct Blk* m_list_nodes =
nullptr;
193 unsigned char* m_buffer =
nullptr;
194 size_t m_buffer_capacity = 0;
196 struct Blk* m_blk_list =
nullptr;
197 size_t m_sizeof_blk = 0;
199 size_t m_sizeof_heap = 0;
249 bool Initialize(
const class ON_RTree& a_rtree);
365 enum { MAX_STACK = 32 };
373 bool PushChildren(
struct StackElement* sp,
bool bFirstChild);
375 StackElement m_stack[MAX_STACK];
381 class ON_CLASS ON_RTree
384 static const ON_RTree Empty;
386 ON_RTree(
size_t leaf_count = 0 );
398 bool CreateMeshFaceTree(
const class ON_Mesh* mesh );
419 bool Insert(
const double a_min[3],
const double a_max[3],
void* a_element_id);
420 bool Insert(
const double a_min[3],
const double a_max[3],
int a_element_id);
421 bool Insert2d(
const double a_min[2],
const double a_max[2],
void* a_element_id);
422 bool Insert2d(
const double a_min[2],
const double a_max[2],
int a_element_id);
443 bool Remove(
const double a_min[3],
const double a_max[3],
void* a_elementId);
444 bool Remove(
const double a_min[3],
const double a_max[3],
int a_elementId);
445 bool Remove2d(
const double a_min[2],
const double a_max[2],
void* a_elementId);
446 bool Remove2d(
const double a_min[2],
const double a_max[2],
int a_elementId);
500 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
506 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
512 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
538 const double a_plane_eqn[4],
541 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
549 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
553 bool Search(
const double a_min[3],
const double a_max[3],
554 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
void* a_context
557 bool Search(
const double a_min[3],
const double a_max[3],
561 bool Search(
const double a_min[3],
const double a_max[3],
565 bool Search(
const double a_min[3],
const double a_max[3],
569 bool Search(
const double a_min[3],
const double a_max[3],
573 bool Search2d(
const double a_min[2],
const double a_max[2],
574 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_id),
void* a_context
577 bool Search2d(
const double a_min[2],
const double a_max[2],
581 bool Search2d(
const double a_min[2],
const double a_max[2],
585 bool Search2d(
const double a_min[2],
const double a_max[2],
589 bool Search2d(
const double a_min[2],
const double a_max[2],
613 const ON_RTree& a_rtreeA,
614 const ON_RTree& a_rtreeB,
640 const ON_RTree& a_rtreeA,
641 const ON_RTree& a_rtreeB,
643 void ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_idA, ON__INT_PTR a_idB),
669 const ON_RTree& a_rtreeA,
670 const ON_RTree& a_rtreeB,
672 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_idA, ON__INT_PTR a_idB),
705 const ON_RTree& a_rtreeA,
706 const ON_RTree& a_rtreeB,
708 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_idA, ON__INT_PTR a_idB,
double* tolerance),
746 void ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_idA, ON__INT_PTR a_idB),
766 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_idA, ON__INT_PTR a_idB),
790 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_idA, ON__INT_PTR a_idB,
double* tolerance),
820 size_t SizeOf()
const;
830 void ReInsert(
ON_RTreeNode*,
struct ON_RTreeListNode**);
833 size_t m_reserved = 0;
Definition: opennurbs_rtree.h:92
Definition: opennurbs_rtree.h:144
Definition: opennurbs_rtree.h:86
Definition: opennurbs_rtree.h:398
Definition: opennurbs_array.h:36
Definition: opennurbs_rtree.h:98
Definition: opennurbs_rtree.h:127
double m_min[3]
Definition: opennurbs_rtree.h:88
Definition: opennurbs_rtree.h:118
Definition: opennurbs_bounding_box.h:25
Definition: opennurbs_rtree.h:151
Definition: opennurbs_mesh.h:2188
Definition: opennurbs_rtree.h:105
Definition: opennurbs_rtree.h:209
double m_max[3]
Definition: opennurbs_rtree.h:89
Typically the vector portion is a unit vector and m_d = -(x*P.x + y*P.y + z*P.z) for a point P on the...
Definition: opennurbs_point.h:1433