From: nds Date: Thu, 23 May 2019 15:39:09 +0000 (+0300) Subject: 0030695: Visualization - selection by box should use clipping planes set for viewer... X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=a83e543155ad5a1d1e781181158941e1eeca7e49;p=occt-copy.git 0030695: Visualization - selection by box should use clipping planes set for viewer - moving check on touching the clipping plane in selection only. --- diff --git a/src/Graphic3d/Graphic3d_ClipPlane.hxx b/src/Graphic3d/Graphic3d_ClipPlane.hxx index 8021edba57..ddbbd321aa 100755 --- a/src/Graphic3d/Graphic3d_ClipPlane.hxx +++ b/src/Graphic3d/Graphic3d_ClipPlane.hxx @@ -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: diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.cxx b/src/SelectMgr/SelectMgr_ViewerSelector.cxx index 34faa79580..a82d320951 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.cxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.cxx @@ -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; }