Iterate over leaves of a BSPTree. More...
#include <BSPTree.hpp>
Classes | |
struct | Corners |
Public Types | |
enum | SideBits { B0154 = 0x33 , B1265 = 0x66 , B2376 = 0xCC , B3047 = 0x99 , B3210 = 0x0F , B4567 = 0xF0 } |
Faces of a hex : corner bitmap. More... | |
enum | XSect { MISS = 0 , SPLIT = 1 , NONHEX = -1 } |
test if a plane intersects the leaf box More... | |
Public Types inherited from moab::BSPTreeIter | |
enum | Direction { LEFT = 0 , RIGHT = 1 } |
Public Member Functions | |
BSPTreeBoxIter () | |
virtual | ~BSPTreeBoxIter () |
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 work to subsequently 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_box_corners (double coords[8][3]) const |
Get coordinates of box corners, in Exodus II hexahedral ordering. More... | |
double | volume () const |
Get volume of leaf box. More... | |
XSect | splits (const BSPTree::Plane &plane) const |
bool | intersects (const BSPTree::Plane &plane) const |
test if a plane intersects the leaf box More... | |
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... | |
ErrorCode | sibling_side (SideBits &side_out) const |
Return the side of the box bounding this tree node that is shared with the immediately adjacent sibling (the tree node that shares a common parent node with this node in the binary tree.) More... | |
ErrorCode | get_neighbors (SideBits side, std::vector< BSPTreeBoxIter > &results, double epsilon=0.0) const |
Get adjacent leaf nodes on indicated side. More... | |
ErrorCode | calculate_polyhedron (BSPTreePoly &polyhedron_out) const |
Calculate the convex polyhedron bounding this leaf. More... | |
Public Member Functions inherited from moab::BSPTreeIter | |
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... | |
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... | |
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... | |
Static Public Member Functions | |
static SideBits | side_above_plane (const double hex_coords[8][3], const BSPTree::Plane &plane) |
static SideBits | side_on_plane (const double hex_coords[8][3], const BSPTree::Plane &plane) |
static SideBits | opposite_face (const SideBits &bits) |
static ErrorCode | face_corners (const SideBits face, const double hex_corners[8][3], double face_corners_out[4][3]) |
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) |
Private Attributes | |
double | leafCoords [8][3] |
std::vector< Corners > | stackData |
Additional Inherited Members | |
Protected Attributes inherited from moab::BSPTreeIter | |
std::vector< EntityHandle > | mStack |
std::vector< EntityHandle > | childVect |
Iterate over leaves of a BSPTree.
Definition at line 369 of file BSPTree.hpp.
Faces of a hex : corner bitmap.
Definition at line 392 of file BSPTree.hpp.
test if a plane intersects the leaf box
Enumerator | |
---|---|
MISS | |
SPLIT | |
NONHEX |
Definition at line 444 of file BSPTree.hpp.
|
inline |
Definition at line 388 of file BSPTree.hpp.
|
inlinevirtual |
Definition at line 389 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 432 of file BSPTree.hpp.
References moab::BSPTreeIter::back().
Referenced by get_neighbors().
|
virtual |
Calculate the convex polyhedron bounding this leaf.
Reimplemented from moab::BSPTreeIter.
Definition at line 1129 of file BSPTree.cpp.
References leafCoords, and moab::BSPTreePoly::set().
|
protectedvirtual |
Reimplemented from moab::BSPTreeIter.
Definition at line 827 of file BSPTree.cpp.
References moab::BSPTreeIter::childVect, moab::BSPTreeBoxIter::Corners::coords, ErrorCode, moab::BSPTree::Plane::flip(), moab::Interface::get_child_meshsets(), leafCoords, MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::BSPTree::moab(), moab::BSPTreeIter::mStack, moab::plane_cut_box(), moab::BSPTreeIter::RIGHT, stackData, and moab::BSPTreeIter::tool().
Referenced by get_neighbors().
|
static |
Definition at line 587 of file BSPTree.cpp.
References B0154, B1265, B2376, B3047, B3210, B4567, moab::copy_coords(), hex_corners, and MB_SUCCESS.
Referenced by get_neighbors().
ErrorCode moab::BSPTreeBoxIter::get_box_corners | ( | double | coords[8][3] | ) | const |
Get coordinates of box corners, in Exodus II hexahedral ordering.
Definition at line 907 of file BSPTree.cpp.
References leafCoords, and MB_SUCCESS.
ErrorCode moab::BSPTreeBoxIter::get_neighbors | ( | SideBits | side, |
std::vector< BSPTreeBoxIter > & | results, | ||
double | epsilon = 0.0 |
||
) | const |
Get adjacent leaf nodes on indicated side.
side | Face of box for which to retrieve neighbors |
results | List to which to append results. This function does not clear existing values in list. |
epsilon | Tolerance on overlap. A positive value E will result in nodes that are separated by as much as E to be considered touching. A negative value -E will cause leaves that do not overlap by at least E to be considered non-overlapping. Amongst other things, this value can be used to control whether or not leaves adjacent at only their edges or corners are returned. |
Definition at line 1024 of file BSPTree.cpp.
References back(), moab::BSPTreeIter::childVect, down(), ErrorCode, face_corners(), moab::Interface::get_child_meshsets(), moab::BSPTree::get_split_plane(), moab::BSPTreeIter::handle(), leafCoords, moab::BSPTreeIter::LEFT, MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::BSPTree::moab(), moab::Interface::num_child_meshsets(), opposite_face(), moab::BSPTreeIter::RIGHT, side_above_plane(), moab::BSPTree::Plane::signed_distance(), moab::BSPTreeIter::tool(), and up().
|
protectedvirtual |
Reimplemented from moab::BSPTreeIter.
Definition at line 547 of file BSPTree.cpp.
References ErrorCode, moab::BSPTree::get_tree_box(), moab::BSPTreeIter::initialize(), leafCoords, MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::point_in_box(), stackData, and moab::BSPTreeIter::tool().
|
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 from moab::BSPTreeIter.
Definition at line 1267 of file BSPTree.cpp.
References leafCoords, and moab::ray_intersect_halfspaces().
bool moab::BSPTreeBoxIter::intersects | ( | const BSPTree::Plane & | plane | ) | const |
test if a plane intersects the leaf box
Definition at line 1001 of file BSPTree.cpp.
References moab::BSPTree::Plane::above(), and leafCoords.
Definition at line 406 of file BSPTree.hpp.
Referenced by get_neighbors().
Return the side of the box bounding this tree node that is shared with the immediately adjacent sibling (the tree node that shares a common parent node with this node in the binary tree.)
Definition at line 1010 of file BSPTree.cpp.
References ErrorCode, moab::BSPTree::get_split_plane(), leafCoords, MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::BSPTreeIter::mStack, side_on_plane(), and moab::BSPTreeIter::tool().
|
static |
Definition at line 561 of file BSPTree.cpp.
References moab::BSPTree::Plane::above().
Referenced by get_neighbors(), and moab::plane_cut_box().
|
static |
Definition at line 569 of file BSPTree.cpp.
References moab::BSPTree::Plane::distance(), and moab::BSPTree::epsilon().
Referenced by moab::plane_uncut_box(), and sibling_side().
BSPTreeBoxIter::XSect moab::BSPTreeBoxIter::splits | ( | const BSPTree::Plane & | plane | ) | const |
Definition at line 961 of file BSPTree.cpp.
References B0154, B1265, B2376, B3047, B3210, B4567, moab::BSPTree::epsilon(), leafCoords, MISS, NONHEX, moab::BSPTree::Plane::signed_distance(), and SPLIT.
|
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 423 of file BSPTree.hpp.
References moab::BSPTreeIter::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 work to subsequently step the other direction.
Reimplemented from moab::BSPTreeIter.
Definition at line 846 of file BSPTree.cpp.
References moab::BSPTreeIter::childVect, moab::BSPTreeBoxIter::Corners::coords, ErrorCode, moab::BSPTree::Plane::flip(), moab::Interface::get_child_meshsets(), moab::BSPTree::get_split_plane(), leafCoords, moab::BSPTreeIter::LEFT, MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::BSPTree::moab(), moab::BSPTreeIter::mStack, moab::plane_cut_box(), moab::plane_uncut_box(), stackData, step_to_first_leaf(), and moab::BSPTreeIter::tool().
Reimplemented from moab::BSPTreeIter.
Definition at line 771 of file BSPTree.cpp.
References moab::BSPTreeIter::childVect, moab::BSPTreeBoxIter::Corners::coords, ErrorCode, moab::BSPTree::Plane::flip(), moab::Interface::get_child_meshsets(), moab::BSPTree::get_split_plane(), leafCoords, MB_SUCCESS, moab::BSPTree::moab(), moab::BSPTreeIter::mStack, moab::plane_cut_box(), moab::BSPTreeIter::RIGHT, stackData, and moab::BSPTreeIter::tool().
Referenced by step().
|
protectedvirtual |
Reimplemented from moab::BSPTreeIter.
Definition at line 797 of file BSPTree.cpp.
References moab::BSPTreeBoxIter::Corners::coords, ErrorCode, moab::BSPTree::get_split_plane(), leafCoords, MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::BSPTreeIter::mStack, moab::plane_uncut_box(), stackData, and moab::BSPTreeIter::tool().
Referenced by get_neighbors().
|
virtual |
Get volume of leaf box.
Reimplemented from moab::BSPTreeIter.
Definition at line 942 of file BSPTree.cpp.
References moab::cross(), moab::dot(), leafCoords, moab::subtr(), and moab::sum().
|
private |
Definition at line 372 of file BSPTree.hpp.
Referenced by calculate_polyhedron(), down(), get_box_corners(), get_neighbors(), initialize(), intersect_ray(), intersects(), sibling_side(), splits(), step(), step_to_first_leaf(), up(), and volume().
|
private |
Definition at line 377 of file BSPTree.hpp.
Referenced by down(), initialize(), step(), step_to_first_leaf(), and up().