]> OCCT Git - occt-copy.git/commitdiff
0030591: Exception is raised by command "bopcheck" on the attached shape
authorgka <gka@opencascade.com>
Mon, 18 Mar 2019 13:06:19 +0000 (16:06 +0300)
committergka <gka@opencascade.com>
Tue, 19 Mar 2019 11:06:43 +0000 (14:06 +0300)
Protection to avoid exception if number of vertices is equal to 1 was added.

src/IntPatch/IntPatch_PrmPrmIntersection.cxx

index 8d07c7b2df76033b1ce0af1203f794c52b66e153..4eb183727418807b21c8bb8469e3ce0568688de1 100644 (file)
@@ -2492,52 +2492,56 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
 
                             Standard_Boolean removeNext = Standard_False;
                             Standard_Boolean removePrev = Standard_False;
-                            if( ciV == 1)
+                            
+                            if(cnbV > 1)
                             {
-                              Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
-                              if(dPar > 10)
+                              if( ciV == 1)
                               {
-                                removeNext = Standard_True;
-                                for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
-                                  VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
-                              }
-                            }
-                            else if( ciV == cnbV)
-                            {
-                              Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
-                              if(dPar > 10)
-                              {
-                                removePrev = Standard_True;
-                                VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
-                              }
-                            }
-                            else
-                            {
-                              Standard_Integer dParMi = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
-                              Standard_Integer dParMa = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
-                              if(dParMi > 10)
-                              {
-                                removePrev = Standard_True;
-                                VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
+                                Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
+                                if(dPar > 10)
+                                {
+                                  removeNext = Standard_True;
+                                  for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
+                                    VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
+                                }
                               }
-
-                              if(dParMa > 10)
+                              else if( ciV == cnbV)
                               {
-                                removeNext = Standard_True;
-                                for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
+                                Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
+                                if(dPar > 10)
                                 {
-                                  if(dParMi > 10)
-                                    VPold.SetValue(iPo, VPold.Value(iPo) - 2 );
-                                  else
-                                    VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
+                                  removePrev = Standard_True;
+                                  VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
                                 }
                               }
                               else
                               {
+                                Standard_Integer dParMi = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
+                                Standard_Integer dParMa = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
                                 if(dParMi > 10)
+                                {
+                                  removePrev = Standard_True;
+                                  VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
+                                }
+
+                                if(dParMa > 10)
+                                {
+                                  removeNext = Standard_True;
                                   for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
-                                    VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
-                              } 
+                                  {
+                                    if(dParMi > 10)
+                                      VPold.SetValue(iPo, VPold.Value(iPo) - 2 );
+                                    else
+                                      VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
+                                  }
+                                }
+                                else
+                                {
+                                  if(dParMi > 10)
+                                    for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
+                                      VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
+                                } 
+                              }
                             }
 
                             Standard_Integer pI = ciVpar;