From: nds Date: Tue, 14 May 2019 10:26:06 +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=refs%2Fheads%2FCR0_DMUReviewer_2_30695;p=occt-copy.git 0030695: Visualization - selection by box should use clipping planes set for viewer - if object touches the clipping plane and not outside, the proposed result state of probeBox is Graphic3d_ClipState_In. --- diff --git a/src/Graphic3d/Graphic3d_ClipPlane.hxx b/src/Graphic3d/Graphic3d_ClipPlane.hxx index 8e4c34835e..8021edba57 100755 --- a/src/Graphic3d/Graphic3d_ClipPlane.hxx +++ b/src/Graphic3d/Graphic3d_ClipPlane.hxx @@ -226,6 +226,11 @@ public: } 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; + } // if at least one full out test fail, clipping state is inconclusive (partially clipped) aState = Graphic3d_ClipState_On; } @@ -271,6 +276,16 @@ public: return IsPointOutHalfspace (aMaxPnt); } + //! Check if the given bounding box is fully outside of the half-space (e.g. should be discarded by clipping plane). + Graphic3d_ClipState ProbeBoxMaxPointHalfspace (const Graphic3d_BndBox3d& theBox) const + { + const Graphic3d_Vec4d aMaxPnt (myEquation.x() > 0.0 ? theBox.CornerMax().x() : theBox.CornerMin().x(), + myEquation.y() > 0.0 ? theBox.CornerMax().y() : theBox.CornerMin().y(), + myEquation.z() > 0.0 ? theBox.CornerMax().z() : theBox.CornerMin().z(), + 1.0); + return ProbePointHalfspace (aMaxPnt); + } + //! Check if the given bounding box is fully inside (or touches from inside) the half-space (e.g. NOT discarded by clipping plane). bool IsBoxFullInHalfspace (const Graphic3d_BndBox3d& theBox) const {