Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::RayIntersectSets Class Reference
+ Inheritance diagram for moab::RayIntersectSets:
+ Collaboration diagram for moab::RayIntersectSets:

Public Member Functions

 RayIntersectSets (OrientedBoxTreeTool *tool_ptr, const double *ray_point, const double *unit_ray_dir, const double tolerance, OrientedBoxTreeTool::IntersectSearchWindow &win, unsigned int *ray_tri_test_count, OrientedBoxTreeTool::IntRegCtxt &intRegCallback)
 
virtual ErrorCode visit (EntityHandle node, int depth, bool &descend)
 Visit a node in the tree during a traversal. More...
 
virtual ErrorCode leaf (EntityHandle node)
 Process a leaf node during tree traversal. More...
 
- Public Member Functions inherited from moab::OrientedBoxTreeTool::Op
virtual ~Op ()
 

Private Attributes

OrientedBoxTreeTooltool
 
const CartVect ray_origin
 
const CartVect ray_direction
 
OrientedBoxTreeTool::IntersectSearchWindowsearch_win
 
const double tol
 
OrientedBoxTreeTool::IntRegCtxtint_reg_callback
 
int * surfTriOrient
 
int surfTriOrient_val
 
unsigned int * raytri_test_count
 
EntityHandle lastSet
 
int lastSetDepth
 

Detailed Description

Definition at line 888 of file OrientedBoxTreeTool.cpp.

Constructor & Destructor Documentation

◆ RayIntersectSets()

moab::RayIntersectSets::RayIntersectSets ( OrientedBoxTreeTool tool_ptr,
const double *  ray_point,
const double *  unit_ray_dir,
const double  tolerance,
OrientedBoxTreeTool::IntersectSearchWindow win,
unsigned int *  ray_tri_test_count,
OrientedBoxTreeTool::IntRegCtxt intRegCallback 
)
inline

Definition at line 911 of file OrientedBoxTreeTool.cpp.

918  : tool( tool_ptr ), ray_origin( ray_point ), ray_direction( unit_ray_dir ), search_win( win ), tol( tolerance ),
919  int_reg_callback( intRegCallback ), surfTriOrient_val( 0 ), raytri_test_count( ray_tri_test_count ),
920  lastSet( 0 ), lastSetDepth( 0 )
921  {
922 
923  // specified orientation should be 1 or -1, indicating ray and surface
924  // normal in the same or opposite directions, respectively.
926  {
928  }
929  else
930  {
931  surfTriOrient = NULL;
932  }
933 
934  // check the limits
935  if( search_win.first )
936  {
937  assert( 0 <= *( search_win.first ) );
938  }
939  if( search_win.second )
940  {
941  assert( 0 >= *( search_win.second ) );
942  }
943  };

References moab::OrientedBoxTreeTool::IntRegCtxt::getDesiredOrient().

Member Function Documentation

◆ leaf()

ErrorCode moab::RayIntersectSets::leaf ( EntityHandle  node)
virtual

Process a leaf node during tree traversal.

Implements moab::OrientedBoxTreeTool::Op.

Definition at line 981 of file OrientedBoxTreeTool.cpp.

982 {
983  assert( lastSet );
984  if( !lastSet ) // if no surface has been visited yet, something's messed up.
985  return MB_FAILURE;
986 
987 #ifndef MB_OBB_USE_VECTOR_QUERIES
988  Range tris;
989 #ifdef MB_OBB_USE_TYPE_QUERIES
990  ErrorCode rval = tool->get_moab_instance()->get_entities_by_type( node, MBTRI, tris );
991 #else
992  ErrorCode rval = tool->get_moab_instance()->get_entities_by_handle( node, tris );
993 #endif
994 #else
995  std::vector< EntityHandle > tris;
996  ErrorCode rval = tool->get_moab_instance()->get_entities_by_handle( node, tris );
997 #endif
998  assert( MB_SUCCESS == rval );
999  if( MB_SUCCESS != rval ) return rval;
1000 
1001 #ifndef MB_OBB_USE_VECTOR_QUERIES
1002  for( Range::iterator t = tris.begin(); t != tris.end(); ++t )
1003 #else
1004  for( std::vector< EntityHandle >::iterator t = tris.begin(); t != tris.end(); ++t )
1005 #endif
1006  {
1007 #ifndef MB_OBB_USE_TYPE_QUERIES
1008  if( TYPE_FROM_HANDLE( *t ) != MBTRI ) continue;
1009 #endif
1010 
1011  const EntityHandle* conn;
1012  int num_conn;
1013  rval = tool->get_moab_instance()->get_connectivity( *t, conn, num_conn, true );
1014  assert( MB_SUCCESS == rval );
1015  if( MB_SUCCESS != rval ) return rval;
1016 
1017  CartVect coords[3];
1018  rval = tool->get_moab_instance()->get_coords( conn, 3, coords[0].array() );
1019  assert( MB_SUCCESS == rval );
1020  if( MB_SUCCESS != rval ) return rval;
1021 
1023 
1024  double int_dist;
1026 
1028  search_win.second, surfTriOrient, &int_type ) )
1029  {
1030  int_reg_callback.register_intersection( lastSet, *t, int_dist, search_win, int_type );
1031  }
1032  }
1033  return MB_SUCCESS;
1034 }

References moab::Range::begin(), moab::Range::end(), ErrorCode, MB_SUCCESS, MBTRI, moab::GeomUtil::NONE, moab::GeomUtil::plucker_ray_tri_intersect(), and moab::TYPE_FROM_HANDLE().

◆ visit()

ErrorCode moab::RayIntersectSets::visit ( EntityHandle  node,
int  depth,
bool &  descend 
)
virtual

Visit a node in the tree during a traversal.

This method is called for each node in the tree visited during a pre-order traversal.

Parameters
nodeThe EntityHandle for the entity set for the tree node.
depthThe current depth in the tree.
descendOutput: if false, traversal will skip children of the current node, or if the current node is a leaf, the 'leaf' method will not be called.

Implements moab::OrientedBoxTreeTool::Op.

Definition at line 949 of file OrientedBoxTreeTool.cpp.

950 {
951  OrientedBox box;
952  ErrorCode rval = tool->box( node, box );
953  assert( MB_SUCCESS == rval );
954  if( MB_SUCCESS != rval ) return rval;
955 
956  descend = box.intersect_ray( ray_origin, ray_direction, tol, search_win.first, search_win.second );
957 
958  if( lastSet && depth <= lastSetDepth ) lastSet = 0;
959 
960  if( descend && !lastSet )
961  {
962  Range tmp_sets;
963  rval = tool->get_moab_instance()->get_entities_by_type( node, MBENTITYSET, tmp_sets );
964  assert( MB_SUCCESS == rval );
965  if( MB_SUCCESS != rval ) return rval;
966 
967  if( !tmp_sets.empty() )
968  {
969  if( tmp_sets.size() > 1 ) return MB_FAILURE;
970  lastSet = *tmp_sets.begin();
971  lastSetDepth = depth;
972 
974  if( MB_SUCCESS != rval ) return rval;
975  }
976  }
977 
978  return MB_SUCCESS;
979 }

References moab::Range::begin(), moab::OrientedBoxTreeTool::box(), moab::Range::empty(), ErrorCode, MB_SUCCESS, MBENTITYSET, and moab::Range::size().

Member Data Documentation

◆ int_reg_callback

OrientedBoxTreeTool::IntRegCtxt& moab::RayIntersectSets::int_reg_callback
private

Definition at line 899 of file OrientedBoxTreeTool.cpp.

◆ lastSet

EntityHandle moab::RayIntersectSets::lastSet
private

Definition at line 907 of file OrientedBoxTreeTool.cpp.

◆ lastSetDepth

int moab::RayIntersectSets::lastSetDepth
private

Definition at line 908 of file OrientedBoxTreeTool.cpp.

◆ ray_direction

const CartVect moab::RayIntersectSets::ray_direction
private

Definition at line 894 of file OrientedBoxTreeTool.cpp.

◆ ray_origin

const CartVect moab::RayIntersectSets::ray_origin
private

Definition at line 893 of file OrientedBoxTreeTool.cpp.

◆ raytri_test_count

unsigned int* moab::RayIntersectSets::raytri_test_count
private

Definition at line 906 of file OrientedBoxTreeTool.cpp.

◆ search_win

OrientedBoxTreeTool::IntersectSearchWindow& moab::RayIntersectSets::search_win
private

Definition at line 895 of file OrientedBoxTreeTool.cpp.

◆ surfTriOrient

int* moab::RayIntersectSets::surfTriOrient
private

Definition at line 902 of file OrientedBoxTreeTool.cpp.

◆ surfTriOrient_val

int moab::RayIntersectSets::surfTriOrient_val
private

Definition at line 903 of file OrientedBoxTreeTool.cpp.

◆ tol

const double moab::RayIntersectSets::tol
private

Definition at line 896 of file OrientedBoxTreeTool.cpp.

◆ tool

OrientedBoxTreeTool* moab::RayIntersectSets::tool
private

Definition at line 892 of file OrientedBoxTreeTool.cpp.


The documentation for this class was generated from the following file: