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 128 {
return (m_level > 0); }
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];
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],
643 void ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_idA, ON__INT_PTR a_idB),
672 bool ON_CALLBACK_CDECL resultCallback(
void* a_context, ON__INT_PTR a_idA, ON__INT_PTR a_idB),
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:90
Definition: opennurbs_rtree.h:142
Definition: opennurbs_rtree.h:84
ON_RTreeBBox m_rect
Definition: opennurbs_rtree.h:118
Definition: opennurbs_rtree.h:381
ON__INT_PTR m_id
Definition: opennurbs_rtree.h:119
Definition: opennurbs_array.h:36
bool IsInternalNode() const
internal nodes have m_level > 0
Definition: opennurbs_rtree.h:127
Definition: opennurbs_rtree.h:96
int m_level
m_level must be a signed int to insure signed compares work correctly
Definition: opennurbs_rtree.h:133
int m_count
number of elements in m_id[]
Definition: opennurbs_rtree.h:145
Definition: opennurbs_rtree.h:125
double m_min[3]
Definition: opennurbs_rtree.h:86
static const ON_RTreeMemPool Empty
Definition: opennurbs_rtree.h:152
double m_radius
Definition: opennurbs_rtree.h:99
double m_radius
Definition: opennurbs_rtree.h:93
Definition: opennurbs_rtree.h:116
Definition: opennurbs_bounding_box.h:25
ON__INT_PTR m_id
Definition: opennurbs_rtree.h:112
Definition: opennurbs_rtree.h:149
static const ON_RTree Empty
Definition: opennurbs_rtree.h:384
ON_RTreeBBox m_rect
Definition: opennurbs_rtree.h:105
Definition: opennurbs_mesh.h:2241
bool IsLeaf() const
branch nodes have m_level = 0
Definition: opennurbs_rtree.h:129
Definition: opennurbs_rtree.h:103
struct ON_RTreeNode * m_child
Definition: opennurbs_rtree.h:111
Definition: opennurbs_rtree.h:209
double m_max[3]
Definition: opennurbs_rtree.h:87
Definition: opennurbs_point.h:1465
int m_count
Definition: opennurbs_rtree.h:138
int m_capacity
m_id[] array capacity (search terminates when m_count == m_capacity)
Definition: opennurbs_rtree.h:144
ON__INT_PTR * m_id
m_id[] = array of search results.
Definition: opennurbs_rtree.h:146