Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures | Public Member Functions
IntPatch_BVHTraversal Class Reference

Performs BVH tree traversal of two polyhedra to find candidate triangle pairs for intersection testing. This class implements the BVH_PairTraverse interface to efficiently find potentially intersecting triangles using bounding box tests. More...

#include <IntPatch_BVHTraversal.hxx>

Inheritance diagram for IntPatch_BVHTraversal:
Inheritance graph
[legend]

Data Structures

struct  TrianglePair
 Pair of triangle indices (both 1-based, original indices in polyhedra). More...
 

Public Member Functions

 IntPatch_BVHTraversal ()
 Creates an empty traversal object.
 
virtual ~IntPatch_BVHTraversal ()
 Destructor.
 
int Perform (IntPatch_PolyhedronBVH &theSet1, IntPatch_PolyhedronBVH &theSet2, bool theSelfInterference=false)
 Performs BVH traversal and collects candidate triangle pairs.
 
const NCollection_DynamicArray< TrianglePair > & Pairs () const
 Returns the collected triangle pairs.
 
void Clear ()
 Clears the collected pairs.
 
- Public Member Functions inherited from BVH_PairTraverse< double, 3 >
 BVH_PairTraverse ()
 
void SetBVHSets (void *theBVHSet1, void *theBVHSet2)
 
virtual bool RejectNode (const BVH_VecNt &theCornerMin1, const BVH_VecNt &theCornerMax1, const BVH_VecNt &theCornerMin2, const BVH_VecNt &theCornerMax2, double &theMetric) const=0
 Leaf element acceptance. Returns true if the pair of elements is accepted, false otherwise.
 
int Select ()
 Performs selection of the elements from two BVH trees by the rules defined in Accept/Reject methods. Returns the number of accepted pairs of elements.
 
int Select (const opencascade::handle< BVH_Tree< double, Dimension > > &theBVH1, const opencascade::handle< BVH_Tree< double, Dimension > > &theBVH2)
 Performs selection of the elements from two BVH trees by the rules defined in Accept/Reject methods. Returns the number of accepted pairs of elements.
 
- Public Member Functions inherited from BVH_BaseTraverse< MetricType >
virtual bool IsMetricBetter (const MetricType &, const MetricType &) const
 
virtual bool RejectMetric (const MetricType &) const
 
virtual bool Stop () const
 

BVH_PairTraverse interface implementation

Rejects pair of nodes if their bounding boxes don't overlap.

Parameters
[in]theCMin1minimum corner of the first node's bounding box
[in]theCMax1maximum corner of the first node's bounding box
[in]theCMin2minimum corner of the second node's bounding box
[in]theCMax2maximum corner of the second node's bounding box
[out]theMetricunused metric parameter
Returns
true if the pair should be rejected (no overlap), false otherwise
virtual bool RejectNode (const BVH_Vec3d &theCMin1, const BVH_Vec3d &theCMax1, const BVH_Vec3d &theCMin2, const BVH_Vec3d &theCMax2, double &theMetric) const override
 First BVH set.
 
virtual bool Accept (const int theIndex1, const int theIndex2) override
 Accepts a pair of leaf elements and stores their original indices.
 

Additional Inherited Members

- Public Types inherited from BVH_PairTraverse< double, 3 >
typedef BVH_Box< double, Dimension >::BVH_VecNt BVH_VecNt
 
- Protected Member Functions inherited from BVH_BaseTraverse< MetricType >
 BVH_BaseTraverse ()
 Destructor.
 
virtual ~BVH_BaseTraverse ()=default
 Destructor.
 
- Protected Attributes inherited from BVH_PairTraverse< double, 3 >
voidmyBVHSet1
 
voidmyBVHSet2
 

Detailed Description

Performs BVH tree traversal of two polyhedra to find candidate triangle pairs for intersection testing. This class implements the BVH_PairTraverse interface to efficiently find potentially intersecting triangles using bounding box tests.

The traversal collects pairs of original (1-based) triangle indices that have overlapping bounding boxes, which should then be tested for actual geometric intersection using IntPatch_InterferencePolyhedron::Intersect().

Constructor & Destructor Documentation

◆ IntPatch_BVHTraversal()

IntPatch_BVHTraversal::IntPatch_BVHTraversal ( )

Creates an empty traversal object.

◆ ~IntPatch_BVHTraversal()

virtual IntPatch_BVHTraversal::~IntPatch_BVHTraversal ( )
virtual

Destructor.

Member Function Documentation

◆ Accept()

virtual bool IntPatch_BVHTraversal::Accept ( const int theIndex1,
const int theIndex2 )
overridevirtual

Accepts a pair of leaf elements and stores their original indices.

Parameters
[in]theIndex10-based index in the first BVH set
[in]theIndex20-based index in the second BVH set
Returns
true (always accepts the pair)

Implements BVH_PairTraverse< double, 3 >.

◆ Clear()

void IntPatch_BVHTraversal::Clear ( )
inline

Clears the collected pairs.

◆ Pairs()

const NCollection_DynamicArray< TrianglePair > & IntPatch_BVHTraversal::Pairs ( ) const
inline

Returns the collected triangle pairs.

◆ Perform()

int IntPatch_BVHTraversal::Perform ( IntPatch_PolyhedronBVH & theSet1,
IntPatch_PolyhedronBVH & theSet2,
bool theSelfInterference = false )

Performs BVH traversal and collects candidate triangle pairs.

Parameters
[in]theSet1BVH set for the first polyhedron
[in]theSet2BVH set for the second polyhedron
[in]theSelfInterferenceif true, skip pairs where first index >= second index (used for self-intersection where we don't want to test same pair twice)
Returns
number of collected pairs

◆ RejectNode()

virtual bool IntPatch_BVHTraversal::RejectNode ( const BVH_Vec3d & theCMin1,
const BVH_Vec3d & theCMax1,
const BVH_Vec3d & theCMin2,
const BVH_Vec3d & theCMax2,
double & theMetric ) const
overridevirtual

First BVH set.


The documentation for this class was generated from the following file: