]> OCCT Git - occt-copy.git/commitdiff
Provide an interface to retrieve selecting volume's planes from SelectBasics_Selectin...
authorvpa <vpa@opencascade.com>
Mon, 17 Oct 2016 15:22:44 +0000 (18:22 +0300)
committervpa <vpa@opencascade.com>
Mon, 17 Oct 2016 15:22:44 +0000 (18:22 +0300)
src/SelectBasics/SelectBasics_SelectingVolumeManager.hxx
src/SelectMgr/SelectMgr_BaseFrustum.hxx
src/SelectMgr/SelectMgr_RectangularFrustum.cxx
src/SelectMgr/SelectMgr_RectangularFrustum.hxx
src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx
src/SelectMgr/SelectMgr_TriangularFrustum.cxx
src/SelectMgr/SelectMgr_TriangularFrustum.hxx
src/SelectMgr/SelectMgr_TriangularFrustumSet.cxx
src/SelectMgr/SelectMgr_TriangularFrustumSet.hxx

index d4d40ea98251e8e5a5b6adb0f87cfd648761257e..63fdf3dec7b76eb5264b863036d0e38475bf22a8 100644 (file)
@@ -96,6 +96,9 @@ public:
 
   virtual Standard_Boolean IsOverlapAllowed() const = 0;
 
+  //! Stores plane equations to the given vector
+  virtual void GetPlanes (NCollection_Vector<NCollection_Vec4<Standard_Real> >& thePlaneEquations) const = 0;
+
 protected:
   SelectionType myActiveSelectionType;      //!< Active selection type: point, box or polyline
 };
index 225b835445cd5a82cbb7229e9c33d087c26dc499..9f56c0f101add45b399e03271fec97e89d7f66bc 100644 (file)
@@ -162,6 +162,9 @@ public:
   //! Computes depth range for global (defined for the whole view) clipping planes.
   Standard_EXPORT virtual void SetViewClipping (const Graphic3d_SequenceOfHClipPlane& /*thePlanes*/) {};
 
+  //! Stores plane equations to the given vector
+  Standard_EXPORT virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const = 0;
+
   DEFINE_STANDARD_RTTIEXT(SelectMgr_BaseFrustum,Standard_Transient)
 
 protected:
index 664d3d43875bbb42a3cab855554a9defa10a97a5..fe491f71c860a8d6981c87e869c477a26f02b300 100644 (file)
@@ -741,3 +741,24 @@ Standard_Boolean SelectMgr_RectangularFrustum::isViewClippingOk (const Standard_
   return myViewClipRange.MaxDepth() > theDepth
     && myViewClipRange.MinDepth() < theDepth;
 }
+
+// =======================================================================
+// function : GetPlanes
+// purpose  :
+// =======================================================================
+void SelectMgr_RectangularFrustum::GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const
+{
+  thePlaneEquations.Clear();
+
+  SelectMgr_Vec4 anEquation;
+  for (Standard_Integer aPlaneIdx = 0; aPlaneIdx < 6; ++aPlaneIdx)
+  {
+    const gp_Vec& aPlaneNorm = myIsOrthographic && aPlaneIdx % 2 == 1 ?
+      myPlanes[aPlaneIdx - 1].Reversed() : myPlanes[aPlaneIdx];
+    anEquation.x() = aPlaneNorm.X();
+    anEquation.y() = aPlaneNorm.Y();
+    anEquation.z() = aPlaneNorm.Z();
+    anEquation.w() = - (aPlaneNorm.XYZ().Dot (myVertices[aPlaneIdx % 2 == 0 ? aPlaneIdx : aPlaneIdx + 2].XYZ()));
+    thePlaneEquations.Append (anEquation);
+  }
+}
index 9cf9c121731f95ee17b2a3814759374eb6888f9d..8cdf79824e392de0cb26665035ce2996c3e49ee2 100644 (file)
@@ -117,6 +117,10 @@ public:
   inline gp_Pnt GetNearPnt() const { return myNearPickedPnt; }
 
   inline gp_Pnt GetFarPnt() const { return myFarPickedPnt; }
+
+  //! Stores plane equations to the given vector
+  Standard_EXPORT virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const Standard_OVERRIDE;
+
 protected:
 
   Standard_EXPORT void segmentSegmentDistance (const gp_Pnt& theSegPnt1,
index 13a4a6e03aff1cbfb40ebaf832f3ca1627090419..d945435125b0a7e618b26464f769eb50a6da8106 100644 (file)
@@ -183,6 +183,18 @@ public:
     return mySelectingVolumes[myActiveSelectionType];
   }
 
+  //! Stores plane equations to the given vector
+  virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const Standard_OVERRIDE
+  {
+    if (myActiveSelectionType == Unknown)
+    {
+      thePlaneEquations.Clear();
+      return;
+    }
+
+    return mySelectingVolumes[myActiveSelectionType]->GetPlanes (thePlaneEquations);
+  }
+
 private:
   enum { Frustum, FrustumSet, VolumeTypesNb };       //!< Defines the amount of available selecting volumes
 
index 79b02a1fc6dfe543eccde4f3ed6f4f1ca2b6a437..8ae203659fd409545481c098e6932c84ebbb9f55 100644 (file)
@@ -285,3 +285,21 @@ void SelectMgr_TriangularFrustum::Clear()
 {
   myBuilder.Nullify();
 }
+
+// =======================================================================
+// function : GetPlanes
+// purpose  :
+// =======================================================================
+void SelectMgr_TriangularFrustum::GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const
+{
+  SelectMgr_Vec4 aPlaneEquation;
+  for (Standard_Integer aPlaneIdx = 0; aPlaneIdx < 5; ++aPlaneIdx)
+  {
+    const gp_Vec& aNorm = myPlanes[aPlaneIdx];
+    aPlaneEquation.x() = aNorm.X();
+    aPlaneEquation.y() = aNorm.Y();
+    aPlaneEquation.z() = aNorm.Z();
+    aPlaneEquation.w() = - (aNorm.XYZ().Dot (myVertices[aPlaneIdx % 2 == 0 ? aPlaneIdx : 1].XYZ()));
+    thePlaneEquations.Append (aPlaneEquation);
+  }
+}
index ceb104f378da4f742a968891b05c26483a035160..6b69f37ac62d59cb800fa78c234f8ec84d56c1c1 100644 (file)
@@ -84,6 +84,9 @@ public:
   //! Nullifies the handle to corresponding builder instance to prevent memory leaks
   Standard_EXPORT void Clear();
 
+  //! Stores plane equations to the given vector
+  Standard_EXPORT virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const Standard_OVERRIDE;
+
 private:
 
   void cacheVertexProjections (SelectMgr_TriangularFrustum* theFrustum);
index c5d8c9fb9dd02a754a53391c8b41d31d983506aa..1604d85411947ef0b5da20b43b90dfb04df92dca 100644 (file)
@@ -224,4 +224,18 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt1
   return Standard_False;
 }
 
+// =======================================================================
+// function : GetPlanes
+// purpose  :
+// =======================================================================
+void SelectMgr_TriangularFrustumSet::GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const
+{
+  thePlaneEquations.Clear();
+
+  for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
+  {
+    anIter.Value()->GetPlanes (thePlaneEquations);
+  }
+}
+
 #undef MEMORY_BLOCK_SIZE
index baad601daf1def049eb94be44edc72b1eeda8093..32e520aafffe692629389b0c2720fffdba95f185 100644 (file)
@@ -75,6 +75,9 @@ public:
                                                      Select3D_TypeOfSensitivity theSensType,
                                                      Standard_Real& theDepth) Standard_OVERRIDE;
 
+  //! Stores plane equations to the given vector
+  Standard_EXPORT virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const Standard_OVERRIDE;
+
 private:
 
     SelectMgr_TriangFrustums myFrustums;