mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0026195: Visualization - optimize selection algorithms
- initial transformation of triangulation is now applied to selecting frustum; - switched from NCollection_Vec3 to gp collections to avoid conversions and usage of macros; - calculation of frustum was refactored to reduce its build time; - double pixel tolerances for selection were replaced by integer ones; - switched to splitting along the main axis only in SelectMgr BVH selection primitive sets.
This commit is contained in:
@@ -17,8 +17,8 @@
|
||||
#define _SelectBasics_SelectingVolumeManager_HeaderFile
|
||||
|
||||
#include <BVH_Box.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <NCollection_Vec3.hxx>
|
||||
|
||||
class Bnd_Box;
|
||||
class gp_Pnt;
|
||||
@@ -44,7 +44,8 @@ public:
|
||||
virtual Standard_Integer GetActiveSelectionType() const = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by box theBox
|
||||
virtual Standard_Boolean Overlaps (const BVH_Box<Standard_Real, 3>& theBox,
|
||||
virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
|
||||
const NCollection_Vec3<Standard_Real>& theBoxMax,
|
||||
Standard_Real& theDepth) = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by axis-aligned bounding box with minimum
|
||||
@@ -53,10 +54,15 @@ public:
|
||||
const NCollection_Vec3<Standard_Real>& theBoxMax,
|
||||
Standard_Boolean* theInside = NULL) = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by point thePt
|
||||
virtual Standard_Boolean Overlaps (const gp_Pnt& thePt,
|
||||
//! Returns true if selecting volume is overlapped by point thePnt
|
||||
virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
||||
Standard_Real& theDepth) = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by point thePnt.
|
||||
//! Does not perform depth calculation, so this method is defined as
|
||||
//! helper function for inclusion test.
|
||||
virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by planar convex polygon, which points
|
||||
//! are stored in theArrayOfPts, taking into account sensitivity type theSensType
|
||||
virtual Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
|
||||
@@ -81,7 +87,7 @@ public:
|
||||
//! to the given point theCOG
|
||||
virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) = 0;
|
||||
|
||||
virtual NCollection_Vec3<Standard_Real> DetectedPoint (const Standard_Real theDepth) const = 0;
|
||||
virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const = 0;
|
||||
|
||||
virtual Standard_Boolean IsOverlapAllowed() const = 0;
|
||||
|
||||
|
@@ -19,7 +19,8 @@ deferred class SensitiveEntity from SelectBasics inherits TShared from MMgt
|
||||
---Purpose: root class; the inheriting classes will be able to give
|
||||
-- sensitive Areas for the dynamic selection algorithms
|
||||
|
||||
uses
|
||||
uses
|
||||
Trsf from gp,
|
||||
EntityOwner,
|
||||
BndBox3d from Select3D,
|
||||
PickResult,
|
||||
@@ -29,7 +30,7 @@ is
|
||||
|
||||
|
||||
Initialize (theOwnerId : EntityOwner;
|
||||
theSensFactor : Real from Standard = 2.0);
|
||||
theSensFactor : Integer from Standard = 2);
|
||||
|
||||
Set (me : mutable;
|
||||
theOwnerId : EntityOwner)
|
||||
@@ -55,7 +56,7 @@ is
|
||||
-- current selecting volume
|
||||
|
||||
SensitivityFactor (me)
|
||||
returns Real from Standard;
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
---Purpose: allows a better sensitivity for
|
||||
-- a specific entity in selection algorithms
|
||||
@@ -78,8 +79,20 @@ is
|
||||
Clear (me : mutable) is deferred;
|
||||
---Purpose: Clears up all the resources and memory allocated
|
||||
|
||||
HasInitLocation (me)
|
||||
returns Boolean from Standard
|
||||
is deferred;
|
||||
---Purpose: Returns true if the shape corresponding to the entity
|
||||
-- has init location.
|
||||
|
||||
InvInitLocation (me)
|
||||
returns Trsf from gp
|
||||
is deferred;
|
||||
---Purpose: Returns inversed location transformation matrix if the shape corresponding
|
||||
-- to this entity has init location set. Otherwise, returns identity matrix.
|
||||
|
||||
SetSensitivityFactor (me : mutable;
|
||||
theSensFactor :Real from Standard)
|
||||
theSensFactor : Integer from Standard)
|
||||
is protected;
|
||||
---C++: inline
|
||||
---Purpose: Allows to manage the sensitivity of the entity
|
||||
@@ -88,5 +101,5 @@ is
|
||||
fields
|
||||
|
||||
myOwnerId : EntityOwner from SelectBasics is protected;
|
||||
mySFactor : Real from Standard;
|
||||
mySFactor : Integer from Standard;
|
||||
end SensitiveEntity;
|
||||
|
@@ -22,7 +22,7 @@
|
||||
// purpose : Creates new empty sensitive entity instance
|
||||
//=======================================================================
|
||||
SelectBasics_SensitiveEntity::SelectBasics_SensitiveEntity (const Handle(SelectBasics_EntityOwner)& theOwnerId,
|
||||
const Standard_Real theSensFactor)
|
||||
const Standard_Integer theSensFactor)
|
||||
: myOwnerId (theOwnerId),
|
||||
mySFactor (theSensFactor) {}
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
// function : SetSensitivityFactor
|
||||
// purpose : Allows to manage the sensitivity of the entity
|
||||
//=======================================================================
|
||||
inline void SelectBasics_SensitiveEntity::SetSensitivityFactor (const Standard_Real theSensFactor)
|
||||
inline void SelectBasics_SensitiveEntity::SetSensitivityFactor (const Standard_Integer theSensFactor)
|
||||
{
|
||||
mySFactor = theSensFactor;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ inline void SelectBasics_SensitiveEntity::SetSensitivityFactor (const Standard_R
|
||||
// function : SensitivityFactor
|
||||
// purpose : Gets sensitivity factor for the entity
|
||||
//=======================================================================
|
||||
inline Standard_Real SelectBasics_SensitiveEntity::SensitivityFactor() const
|
||||
inline Standard_Integer SelectBasics_SensitiveEntity::SensitivityFactor() const
|
||||
{
|
||||
return mySFactor;
|
||||
}
|
||||
|
Reference in New Issue
Block a user