[cgma-dev] r5102 - cgm/trunk/geom/OCC

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Mon Aug 15 12:27:13 CDT 2011


Author: janehu
Date: 2011-08-15 12:27:12 -0500 (Mon, 15 Aug 2011)
New Revision: 5102

Modified:
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
Replaced tolerance check for connecting vertices in loop direction check by comparing forward and reversed direction vertices distance to better handle model tolerance problem. Added model file in itap dir.

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2011-08-13 19:15:27 UTC (rev 5101)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2011-08-15 17:27:12 UTC (rev 5102)
@@ -2328,22 +2328,39 @@
   if(coedges_new.size() > 1)
   {
     OCCCoEdge* coedge = coedges_new.get_and_step();
-    double    d1, d2;
+    double    d1, d1_, d2, d2_;
     OCCCoEdge* next_coedge = coedges_new.get();
+    //because of tolerance issue, now check current loop end vertices distance
+    //compared with reversed loop's end vertices distance, which ever shorter
+    //will be the direction.
+    //current loop's parameter not using " _ ", reversed loop's parameter
+    //uses " _ ".
     if (coedge->sense() == CUBIT_FORWARD)
+    { 
       d1 = coedge->curve()->end_param();
+      d1_ = coedge->curve()->start_param();
+    }
     else
+    {
       d1 = coedge->curve()->start_param();
+      d1_ = coedge->curve()->end_param();
+    }
     if( next_coedge->sense() == CUBIT_FORWARD)
+    {
+      d2_ = next_coedge->curve()->end_param();
       d2 = next_coedge->curve()->start_param();
+    }
     else
+    {
       d2 = next_coedge->curve()->end_param();
-    CubitVector v1, v2;
+      d2_ = next_coedge->curve()->start_param();
+    } 
+    CubitVector v1, v1_, v2, v2_;
     coedge->curve()->position_from_u(d1, v1);
+    coedge->curve()->position_from_u(d1_, v1_);
     next_coedge->curve()->position_from_u(d2, v2);
-    //get_sme_resabs_tolerance() = 1*10^-7, while the distance difference
-    //we consider would be 1*10^-6.
-    if(v1.distance_between(v2) > get_sme_resabs_tolerance()*10)
+    next_coedge->curve()->position_from_u(d2_, v2_);
+    if(v1.distance_between(v2) > v1_.distance_between(v2_))
     {
       //Reverse all coedges' senses.
       for (int i = 0; i < coedges_new.size(); i ++)




More information about the cgma-dev mailing list