[MOAB-dev] r4876 - in MOAB/trunk/src: . moab

iulian at mcs.anl.gov iulian at mcs.anl.gov
Wed May 25 00:40:12 CDT 2011


Author: iulian
Date: 2011-05-25 00:40:11 -0500 (Wed, 25 May 2011)
New Revision: 4876

Modified:
   MOAB/trunk/src/FBEngine.cpp
   MOAB/trunk/src/moab/FBEngine.hpp
Log:
increase robustness of the splitting
a splitting polygonal line that is not closed has to start and end at a 
boundary mesh node 


Modified: MOAB/trunk/src/FBEngine.cpp
===================================================================
--- MOAB/trunk/src/FBEngine.cpp	2011-05-24 22:29:54 UTC (rev 4875)
+++ MOAB/trunk/src/FBEngine.cpp	2011-05-25 05:40:11 UTC (rev 4876)
@@ -1104,55 +1104,93 @@
   std::vector<EntityHandle> nodes; // get the nodes closest to the ray traces of interest
   std::vector<EntityHandle> trianglesAlong;
 
+  // these are nodes on the boundary of original face;
+  // if the cutting line is not closed, the starting - ending vertices of the
+  // polygonal line must come from this list
+
+  std::vector<CartVect> b_pos;
+  std::vector<EntityHandle> boundary_nodes;
+  if (!closed)
+  {
+    rval = boundary_nodes_on_face(face, boundary_nodes);
+    MBERRORR(rval, "Failed to get boundary nodes.");
+    b_pos.resize(boundary_nodes.size());
+    rval = _mbImpl->get_coords(&(boundary_nodes[0]), boundary_nodes.size(), (double *)(&b_pos[0][0]));
+    MBERRORR(rval, "Failed to get coordinates for boundary nodes.");
+  }
+  //
   int i = 0;
   for (; i < numIniPoints; i++) {
+
     const double point[] = { xyz[3 * i], xyz[3 * i + 1], xyz[3 * i + 2] };// or even point( &(xyz[3*i]) ); //
-    std::vector<double> distances_out;
-    std::vector<EntityHandle> sets_out;
-    std::vector<EntityHandle> facets_out;
-    rval = _my_geomTopoTool->obb_tree()-> ray_intersect_sets(distances_out,
-        sets_out, facets_out, rootForFace, tolerance,
-        min_tolerace_intersections, point, dir);
-    MBERRORR(rval, "Failed to get ray intersections.");
-    if (distances_out.size() < 1)
-      MBERRORR(MB_FAILURE, "Failed to get one intersection point, bad direction.");
-
-    if (distances_out.size() > 1) {
-      std::cout
-          << " too many intersection points. Only the first one considered\n";
+    if (!closed && ( (0==i) || (numIniPoints-1==i) ) )
+    {
+      // find the closest boundary point based on absolute distance
+      // (we do not consider the shooting direction at all...)
+      CartVect pierce(point);
+      int index = 0;
+      double dist2min= (pierce-b_pos[0]).length_squared();
+      for ( unsigned int j = 1; j<boundary_nodes.size(); ++j )
+      {
+        double d2 = (pierce-b_pos[j]).length_squared();
+        if ( d2<dist2min )


More information about the moab-dev mailing list