cgma
|
#include <RStarTree.hpp>
Classes | |
class | LessThan |
Public Types | |
typedef double(* | DistSqFunc )(CubitVector &a, Z &b) |
Public Member Functions | |
RStarTree (double tol=GEOMETRY_RESABS) | |
RStarTree (double tol, int max_c, int min_c) | |
~RStarTree () | |
void | set_tol (double tol) |
double | get_tol () |
Private Member Functions | |
CubitStatus | recursive_find (RStarTreeNode< Z > *rect_tree, const CubitBox &range_box, DLIList< Z > &range_members) |
void | to_list (DLIList< RStarTreeNode< Z > * > &member_list, RStarTreeNode< Z > *top) |
double | min_dist_sq (CubitVector &q, CubitBox &b_box) |
Private Attributes | |
double | myTolerance |
int | maxChildren |
int | minChildren |
RStarTreeNode< Z > * | myRoot |
Definition at line 24 of file RStarTree.hpp.
typedef double(* RStarTree< Z >::DistSqFunc)(CubitVector &a, Z &b) |
Definition at line 66 of file RStarTree.hpp.
RStarTree< Z >::RStarTree | ( | double | tol = GEOMETRY_RESABS | ) |
Definition at line 33 of file RStarTree.cpp.
Definition at line 70 of file RStarTree.hpp.
{return myTolerance;}
MY_INLINE double RStarTree< Z >::min_dist_sq | ( | CubitVector & | q, |
CubitBox & | b_box | ||
) | [private] |
Definition at line 110 of file RStarTree.cpp.
{ CubitVector b_min, b_max; b_min = b_box.minimum(); b_max = b_box.maximum(); double dist; CubitVector r; if ( q.x() < b_min.x() ) r.x(b_min.x()); else if ( q.x() > b_max.x() ) r.x(b_max.x()); else r.x(q.x()); if ( q.y() < b_min.y() ) r.y(b_min.y()); else if ( q.y() > b_max.y() ) r.y(b_max.y()); else r.y(q.y()); if ( q.z() < b_min.z() ) r.z(b_min.z()); else if ( q.z() > b_max.z() ) r.z(b_max.z()); else r.z(q.z()); dist = (q-r).length_squared(); return dist; }
MY_INLINE CubitStatus RStarTree< Z >::recursive_find | ( | RStarTreeNode< Z > * | rect_tree, |
const CubitBox & | range_box, | ||
DLIList< Z > & | range_members | ||
) | [private] |
Definition at line 64 of file RStarTree.cpp.
{ CubitBox rect_box = rect_tree->bounding_box(); if ( !range_box.overlap(myTolerance, rect_box ) ) return CUBIT_SUCCESS; //Now see if this is a data member. If it is, append the data to the //list. if (rect_tree->is_data() ) { range_members.append(rect_tree->get_data()); return CUBIT_SUCCESS; } //Now if this is anything else we need to keep iterating... int loop_size = rect_tree->num_children(); //We are doing a depth-first search of the tree. Not //all branches will need to be followed since they won't //all overlap... int ii; RStarTreeNode<Z> *curr_node; CubitStatus stat; for ( ii = 0; ii < loop_size; ii++ ) { curr_node = rect_tree->get_child(ii); if ( curr_node == NULL ) { PRINT_ERROR("Problems finding boxes in range.\n"); assert(curr_node != NULL); return CUBIT_FAILURE; } stat = recursive_find(curr_node, range_box, range_members); if ( stat != CUBIT_SUCCESS ) return stat; } return CUBIT_SUCCESS; }
Definition at line 68 of file RStarTree.hpp.
{myTolerance = tol;}
MY_INLINE void RStarTree< Z >::to_list | ( | DLIList< RStarTreeNode< Z > * > & | member_list, |
RStarTreeNode< Z > * | top | ||
) | [private] |
Definition at line 46 of file RStarTree.cpp.
{ //Get the children of the top into the list. int ii; RStarTreeNode <Z> *curr_node; for ( ii = 0; ii < top->num_children(); ii++ ) { curr_node = top->get_child(ii); member_list.append(curr_node); //don't go below the bottom level... if ( curr_node->get_leaf_level() == 0 ) continue; to_list(member_list, curr_node); } return; }
int RStarTree< Z >::maxChildren [private] |
Definition at line 28 of file RStarTree.hpp.
int RStarTree< Z >::minChildren [private] |
Definition at line 29 of file RStarTree.hpp.
RStarTreeNode<Z>* RStarTree< Z >::myRoot [private] |
Definition at line 30 of file RStarTree.hpp.
double RStarTree< Z >::myTolerance [private] |
Definition at line 27 of file RStarTree.hpp.