]> OCCT Git - occt-copy.git/commitdiff
0030695: Visualization - selection by box should use clipping planes set for viewer...
authornds <nds@opencascade.com>
Thu, 23 May 2019 15:39:09 +0000 (18:39 +0300)
committernds <nds@opencascade.com>
Thu, 23 May 2019 15:39:09 +0000 (18:39 +0300)
src/Graphic3d/Graphic3d_ClipPlane.hxx
src/SelectMgr/SelectMgr_ViewerSelector.cxx

index 8021edba570436de146b41fae614c755c1ac4e0b..ddbbd321aaa61a788a67466c9638894022e18835 100755 (executable)
@@ -225,17 +225,37 @@ public:
         return Graphic3d_ClipState_In;
       }
       else if (!aPlaneIter->IsBoxFullOutHalfspace (theBox))
+      {
+        // if at least one full out test fail, clipping state is inconclusive (partially clipped)
+        aState = Graphic3d_ClipState_On;
+      }
+    }
+    return aState;
+  }
+
+  //! Check if the given bounding box is In and touch the clipping planes
+  Standard_Boolean ProbeBoxTouch (const Graphic3d_BndBox3d& theBox) const
+  {
+    Graphic3d_ClipState aState = Graphic3d_ClipState_Out;
+    for (const Graphic3d_ClipPlane* aPlaneIter = this; aPlaneIter != NULL; aPlaneIter = aPlaneIter->myNextInChain.get())
+    {
+      if (aPlaneIter->IsBoxFullInHalfspace (theBox))
+      {
+        // within union operation, if box is entirely inside at least one half-space, others can be ignored
+        return Standard_False;
+      }
+      else if (!aPlaneIter->IsBoxFullOutHalfspace (theBox))
       {
         // the box is not fully out, and not fully in, check is it on (but not intersect)
         if (ProbeBoxMaxPointHalfspace (theBox) != Graphic3d_ClipState_Out)
         {
-          return Graphic3d_ClipState_In;
+          return Standard_True;
         }
         // if at least one full out test fail, clipping state is inconclusive (partially clipped)
         aState = Graphic3d_ClipState_On;
       }
     }
-    return aState;
+    return Standard_False;
   }
 
 public:
index 34faa79580ac034747249d8fb639c988f94ac0d8..a82d320951d338d0616090b087250b7998e54e67 100644 (file)
@@ -518,6 +518,8 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
           }
           if (aState == Graphic3d_ClipState_On && !mySelectingVolumeMgr.IsOverlapAllowed()) // partially clipped
           {
+            if (aPlane->ProbeBoxTouch (aBBox))
+              continue;
             aClipped = true;
             break;
           }