1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0028789: Visualization, TKV3d - extend API for accessing and assigning BVH builders

Several methods in Selection classes have been moved to header files for better inlining.

BVH_Constants - added new enumeration defining common constant values used with BVH trees.
BVH - replaced NCollection_Handle with Standard_Transient handle
in classes BVH_Properties, BVH_Builder, BVH_Tree, BVH_Object.

Defined global BVH-builders instead of allocating a new one for each object set.
SelectMgr_ViewerSelector - added new method ::SetEntitySetBuilder() defining
default BVH Tree builder for SelectMgr_SensitiveEntitySet.

Added new method SelectMgr_SensitiveEntitySet::SetBuilder()
for overriding default BVH tree builder.
This commit is contained in:
kgv
2017-05-26 10:45:22 +03:00
committed by bugmaster
parent 645f581fbe
commit f5b7241978
54 changed files with 561 additions and 357 deletions

View File

@@ -703,8 +703,8 @@ void BRepExtrema_OverlapTool::Perform (const Standard_Real theTolerance)
BRepExtrema_StackItem aStack[96];
const NCollection_Handle<BVH_Tree<Standard_Real, 3> >& aBVH1 = mySet1->BVH();
const NCollection_Handle<BVH_Tree<Standard_Real, 3> >& aBVH2 = mySet2->BVH();
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVH1 = mySet1->BVH();
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVH2 = mySet2->BVH();
if (aBVH1.IsNull() || aBVH2.IsNull())
{

View File

@@ -21,18 +21,16 @@
#include <Poly_Triangulation.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepExtrema_TriangleSet,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
//=======================================================================
//function : BRepExtrema_TriangleSet
//purpose : Creates empty triangle set
//=======================================================================
BRepExtrema_TriangleSet::BRepExtrema_TriangleSet()
: BVH_PrimitiveSet<Standard_Real, 3>()
{
// Set default builder - linear BVH (LBVH)
myBuilder = new BVH_LinearBuilder<Standard_Real, 3> (5, 32);
myBuilder = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeDefault, BVH_Constants_MaxTreeDepth);
}
//=======================================================================
@@ -40,10 +38,9 @@ BRepExtrema_TriangleSet::BRepExtrema_TriangleSet()
//purpose : Creates triangle set from the given face
//=======================================================================
BRepExtrema_TriangleSet::BRepExtrema_TriangleSet (const BRepExtrema_ShapeList& theFaces)
: BVH_PrimitiveSet<Standard_Real, 3>()
{
// Set default builder - linear BVH (LBVH)
myBuilder = new BVH_LinearBuilder<Standard_Real, 3> (5, 32);
myBuilder = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeDefault, BVH_Constants_MaxTreeDepth);
Init (theFaces);
}

View File

@@ -17,13 +17,13 @@
#define _BRepExtrema_TriangleSet_HeaderFile
#include <TopoDS_Face.hxx>
#include <BVH_PrimitiveSet.hxx>
#include <BVH_PrimitiveSet3d.hxx>
//! List of shapes and their IDs for collision detection.
typedef NCollection_Vector<TopoDS_Face> BRepExtrema_ShapeList;
//! Triangle set corresponding to specific face.
class BRepExtrema_TriangleSet : public BVH_PrimitiveSet<Standard_Real, 3>, public Standard_Transient
class BRepExtrema_TriangleSet : public BVH_PrimitiveSet3d
{
public:
@@ -45,7 +45,7 @@ public: //! @name methods implementing BVH set interface
BVH_Box<Standard_Real, 3> Box (const Standard_Integer theIndex) const Standard_OVERRIDE;
//! Make inherited method Box() visible to avoid CLang warning
using BVH_PrimitiveSet<Standard_Real, 3>::Box;
using BVH_PrimitiveSet3d::Box;
//! Returns centroid position along specified axis.
Standard_Real Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const Standard_OVERRIDE;
@@ -83,10 +83,10 @@ protected:
public:
DEFINE_STANDARD_RTTIEXT(BRepExtrema_TriangleSet,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
};
DEFINE_STANDARD_HANDLE (BRepExtrema_TriangleSet, Standard_Transient)
DEFINE_STANDARD_HANDLE(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
#endif // _BRepExtrema_TriangleSet_HeaderFile