Iterate over leaves of a BSPTree. More...
#include <BSPTree.hpp>
Public Types | |
enum | Direction { LEFT = 0 , RIGHT = 1 } |
Public Member Functions | |
BSPTreeIter () | |
virtual | ~BSPTreeIter () |
BSPTree * | tool () const |
EntityHandle | handle () const |
Get handle for current leaf. More... | |
unsigned | depth () const |
Get depth in tree. root is at depth of 1. More... | |
virtual ErrorCode | step (Direction direction) |
Advance the iterator either left or right in the tree Note: stepping past the end of the tree will invalidate the iterator. It will not be work step the other direction. More... | |
ErrorCode | step () |
Advance to next leaf Returns MB_ENTITY_NOT_FOUND if at end. Note: stepping past the end of the tree will invalidate the iterator. Calling back() will not work. More... | |
ErrorCode | back () |
Move back to previous leaf Returns MB_ENTITY_NOT_FOUND if at beginning. Note: stepping past the start of the tree will invalidate the iterator. Calling step() will not work. More... | |
ErrorCode | get_parent_split_plane (BSPTree::Plane &plane) const |
Get split plane that separates this node from its immediate sibling. More... | |
virtual double | volume () const |
Get volume of leaf polyhedron. More... | |
virtual bool | intersect_ray (const double ray_point[3], const double ray_vect[3], double &t_enter, double &t_exit) const |
Find range of overlap between ray and leaf. More... | |
bool | is_sibling (const BSPTreeIter &other_leaf) const |
Return true if thos node and the passed node share the same immediate parent. More... | |
bool | is_sibling (EntityHandle other_leaf) const |
Return true if thos node and the passed node share the same immediate parent. More... | |
bool | sibling_is_forward () const |
Returns true if calling step() will advance to the immediate sibling of the current node. Returns false if current node is root or back() will move to the immediate sibling. More... | |
virtual ErrorCode | calculate_polyhedron (BSPTreePoly &polyhedron_out) const |
Calculate the convex polyhedron bounding this leaf. More... | |
Protected Member Functions | |
virtual ErrorCode | step_to_first_leaf (Direction direction) |
virtual ErrorCode | up () |
virtual ErrorCode | down (const BSPTree::Plane &plane, Direction direction) |
virtual ErrorCode | initialize (BSPTree *tool, EntityHandle root, const double *point=0) |
Protected Attributes | |
std::vector< EntityHandle > | mStack |
std::vector< EntityHandle > | childVect |
Private Attributes | |
BSPTree * | treeTool |
Friends | |
class | BSPTree |
Iterate over leaves of a BSPTree.
Definition at line 252 of file BSPTree.hpp.
Enumerator | |
---|---|
LEFT | |
RIGHT |
Definition at line 255 of file BSPTree.hpp.
|
inline |
Definition at line 278 of file BSPTree.hpp.
|
inlinevirtual |
Definition at line 279 of file BSPTree.hpp.
|
inline |
Move back to previous leaf Returns MB_ENTITY_NOT_FOUND if at beginning. Note: stepping past the start of the tree will invalidate the iterator. Calling step() will not work.
Definition at line 317 of file BSPTree.hpp.
Referenced by moab::BSPTreeBoxIter::back().
|
virtual |
Calculate the convex polyhedron bounding this leaf.
Reimplemented in moab::BSPTreeBoxIter.
Definition at line 512 of file BSPTree.cpp.
References moab::CartVect::array(), childVect, moab::BSPTree::Plane::coeff, moab::BSPTreePoly::cut_polyhedron(), ErrorCode, moab::BSPTree::Plane::flip(), moab::Interface::get_child_meshsets(), moab::BSPTree::get_split_plane(), moab::BSPTree::get_tree_box(), MB_SUCCESS, moab::BSPTree::moab(), mStack, moab::BSPTree::Plane::norm, moab::BSPTreePoly::set(), and treeTool.
Referenced by volume().
|
inline |
Get depth in tree. root is at depth of 1.
Definition at line 293 of file BSPTree.hpp.
References mStack.
Referenced by moab::BSPTree::merge_leaf().
|
protectedvirtual |
Reimplemented in moab::BSPTreeBoxIter.
Definition at line 449 of file BSPTree.cpp.
References childVect, ErrorCode, moab::Interface::get_child_meshsets(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::BSPTree::moab(), mStack, and tool().
Referenced by moab::BSPTree::leaf_containing_point().
ErrorCode moab::BSPTreeIter::get_parent_split_plane | ( | BSPTree::Plane & | plane | ) | const |
Get split plane that separates this node from its immediate sibling.
Definition at line 460 of file BSPTree.cpp.
References moab::BSPTree::get_split_plane(), MB_ENTITY_NOT_FOUND, mStack, and tool().
|
inline |
Get handle for current leaf.
Definition at line 287 of file BSPTree.hpp.
References mStack.
Referenced by moab::BSPTreeBoxIter::get_neighbors(), is_sibling(), moab::BSPTree::leaf_containing_point(), moab::BSPTree::merge_leaf(), sibling_is_forward(), and moab::BSPTree::split_leaf().
|
protectedvirtual |
Reimplemented in moab::BSPTreeBoxIter.
Definition at line 374 of file BSPTree.cpp.
References MB_SUCCESS, mStack, and treeTool.
Referenced by moab::BSPTree::get_tree_end_iterator(), moab::BSPTree::get_tree_iterator(), moab::BSPTreeBoxIter::initialize(), and moab::BSPTree::leaf_containing_point().
|
virtual |
Find range of overlap between ray and leaf.
ray_point | Coordinates of start point of ray |
ray_vect | Directionion vector for ray such that the ray is defined by r(t) = ray_point + t * ray_vect for t > 0. |
t_enter | Output: if return value is true, this value is the parameter location along the ray at which the ray entered the leaf. If return value is false, then this value is undefined. |
t_exit | Output: if return value is true, this value is the parameter location along the ray at which the ray exited the leaf. If return value is false, then this value is undefined. |
Reimplemented in moab::BSPTreeBoxIter.
Definition at line 1338 of file BSPTree.cpp.
References ErrorCode, moab::BSPTree::get_tree_box(), MB_SUCCESS, mStack, moab::ray_intersect_halfspaces(), and tool().
bool moab::BSPTreeIter::is_sibling | ( | const BSPTreeIter & | other_leaf | ) | const |
Return true if thos node and the passed node share the same immediate parent.
Definition at line 476 of file BSPTree.cpp.
bool moab::BSPTreeIter::is_sibling | ( | EntityHandle | other_leaf | ) | const |
Return true if thos node and the passed node share the same immediate parent.
Definition at line 483 of file BSPTree.cpp.
References childVect, ErrorCode, moab::Interface::get_child_meshsets(), handle(), MB_SUCCESS, moab::BSPTree::moab(), mStack, and tool().
bool moab::BSPTreeIter::sibling_is_forward | ( | ) | const |
Returns true if calling step() will advance to the immediate sibling of the current node. Returns false if current node is root or back() will move to the immediate sibling.
Definition at line 497 of file BSPTree.cpp.
References childVect, ErrorCode, moab::Interface::get_child_meshsets(), handle(), MB_SUCCESS, moab::BSPTree::moab(), mStack, and tool().
|
inline |
Advance to next leaf Returns MB_ENTITY_NOT_FOUND if at end. Note: stepping past the end of the tree will invalidate the iterator. Calling back() will not work.
Definition at line 308 of file BSPTree.hpp.
References RIGHT.
Referenced by back(), and moab::BSPTreeBoxIter::step().
Advance the iterator either left or right in the tree Note: stepping past the end of the tree will invalidate the iterator. It will not be work step the other direction.
Reimplemented in moab::BSPTreeBoxIter.
Definition at line 398 of file BSPTree.cpp.
References childVect, ErrorCode, moab::Interface::get_child_meshsets(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::BSPTree::moab(), mStack, step_to_first_leaf(), and tool().
Reimplemented in moab::BSPTreeBoxIter.
Definition at line 382 of file BSPTree.cpp.
References childVect, ErrorCode, moab::Interface::get_child_meshsets(), MB_SUCCESS, moab::BSPTree::moab(), mStack, and tool().
Referenced by moab::BSPTree::get_tree_end_iterator(), moab::BSPTree::get_tree_iterator(), moab::BSPTree::split_leaf(), and step().
|
inline |
Definition at line 281 of file BSPTree.hpp.
References treeTool.
Referenced by down(), moab::BSPTreeBoxIter::down(), moab::BSPTreeBoxIter::get_neighbors(), get_parent_split_plane(), moab::BSPTreeBoxIter::initialize(), intersect_ray(), is_sibling(), sibling_is_forward(), moab::BSPTreeBoxIter::sibling_side(), step(), moab::BSPTreeBoxIter::step(), step_to_first_leaf(), moab::BSPTreeBoxIter::step_to_first_leaf(), and moab::BSPTreeBoxIter::up().
|
protectedvirtual |
Reimplemented in moab::BSPTreeBoxIter.
Definition at line 442 of file BSPTree.cpp.
References MB_ENTITY_NOT_FOUND, MB_SUCCESS, and mStack.
Referenced by moab::BSPTree::merge_leaf().
|
virtual |
Get volume of leaf polyhedron.
Reimplemented in moab::BSPTreeBoxIter.
Definition at line 469 of file BSPTree.cpp.
References calculate_polyhedron(), ErrorCode, MB_SUCCESS, and moab::BSPTreePoly::volume().
|
friend |
Definition at line 262 of file BSPTree.hpp.
|
mutableprotected |
Definition at line 268 of file BSPTree.hpp.
Referenced by calculate_polyhedron(), down(), moab::BSPTreeBoxIter::down(), moab::BSPTreeBoxIter::get_neighbors(), is_sibling(), moab::BSPTree::leaf_containing_point(), moab::BSPTree::merge_leaf(), sibling_is_forward(), step(), moab::BSPTreeBoxIter::step(), step_to_first_leaf(), and moab::BSPTreeBoxIter::step_to_first_leaf().
|
protected |
Definition at line 267 of file BSPTree.hpp.
Referenced by calculate_polyhedron(), depth(), down(), moab::BSPTreeBoxIter::down(), get_parent_split_plane(), handle(), initialize(), intersect_ray(), is_sibling(), sibling_is_forward(), moab::BSPTreeBoxIter::sibling_side(), step(), moab::BSPTreeBoxIter::step(), step_to_first_leaf(), moab::BSPTreeBoxIter::step_to_first_leaf(), up(), and moab::BSPTreeBoxIter::up().
|
private |
Definition at line 264 of file BSPTree.hpp.
Referenced by calculate_polyhedron(), initialize(), and tool().