1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0030655: Modeling Data - Provide interfaces for selection of the elements from BVH tree

Provide the easy to use interfaces for selection of the elements from BVH tree.
The selection rules should be implemented in the selector class derived from *BVH_Traverse* or in *BVH_PairTraverse* in Reject/Accept methods.

The *BVH_Traverse* is used for selection of the elements from the tree.
The *BVH_PairTraverse* is used for selection of the pairs of elements from two BVH trees.

Auxiliary changes:
- Two methods BVH_Box::IsOut(OtherBox) and BVH_Box::IsOut(Point) have been added;
- Added methods for conversion of Bnd boxes to BVH boxes

Added new class *BVH_Tools* containing useful static methods operating on BVH points and boxes.

The classes BRepExtrema_OverlapTool and BVH_DistanceField have been rebased to use the new traverse methods.
This commit is contained in:
emv
2019-04-17 17:29:02 +03:00
committed by bugmaster
parent 1b827f0484
commit 7c1a821000
24 changed files with 2684 additions and 481 deletions

View File

@@ -0,0 +1,58 @@
puts "======="
puts "0030655: Modeling Data - Provide interfaces for selection of the elements from BVH tree"
puts "======="
puts ""
pload QAcommands
box b 10 10 10
# select elements interfering with each vertex (must be one vertex (itself), three edges and three faces - 7 in total)
foreach v [explode b v] {
QABVH_ShapeSelect r_$v b $v
QABVH_ShapeSelect rv_$v b $v -void
if { [llength [explode r_$v]] != 7} {
puts "Error: incorrect selection"
}
checknbshapes rv_$v -ref [nbshapes r_$v]
checkprops rv_$v -equal r_$v
}
# select elements interfering with each edge (must be two vertices, five edges and and four faces - 11 in total)
foreach e [explode b e] {
QABVH_ShapeSelect r_$e b $e
QABVH_ShapeSelect rv_$e b $e -void
if { [llength [explode r_$e]] != 11} {
puts "Error: incorrect selection"
}
checknbshapes rv_$e -ref [nbshapes r_$e]
checkprops rv_$e -equal r_$e
}
# select elements interfering with each face (must be ffour vertices, eight edges and and five faces - 17 in total)
foreach f [explode b f] {
QABVH_ShapeSelect r_$f b $f
QABVH_ShapeSelect rv_$f b $f -void
if { [llength [explode r_$f]] != 17} {
puts "Error: incorrect selection"
}
checknbshapes rv_$f -ref [nbshapes r_$f]
checkprops rv_$f -equal r_$f
}
# intersect the box with itself - select all interfering pairs (8 * 7 + 12 * 11 + 6 * 17 = 290)
QABVH_PairSelect r b b
QABVH_PairSelect rv b b -void
if { [llength [explode r]] != 290} {
puts "Error: incorrect selection"
}
checknbshapes rv -ref [nbshapes r]
checkprops rv -equal r

View File

@@ -0,0 +1,16 @@
puts "======="
puts "0030655: Modeling Data - Provide interfaces for selection of the elements from BVH tree"
puts "======="
puts ""
pload QAcommands
box b1 10 10 10
box b2 20 0 0 10 10 10
incmesh b1 0.1
incmesh b2 0.1
regexp {Distance ([-0-9.+eE]*)} [QABVH_PairDistance b1 b2] full dist
checkreal "Distance" $dist 10 0 1.e-2

View File

@@ -0,0 +1,21 @@
puts "======="
puts "0030655: Modeling Data - Provide interfaces for selection of the elements from BVH tree"
puts "======="
puts ""
pload QAcommands
psphere s1 100
psphere s2 110
ttranslate s2 150 150 150
incmesh s1 0.01
incmesh s2 0.01
dchrono stime start
regexp {Distance ([-0-9.+eE]*)} [QABVH_PairDistance s1 s2] full dist
dchrono stime stop counter MESH_MESH_DISTANCE
distmini d s1 s2
checkreal "Distance" $dist [dval d_val] 0 1.e-2

View File

@@ -0,0 +1,13 @@
puts "======="
puts "0030655: Modeling Data - Provide interfaces for selection of the elements from BVH tree"
puts "======="
puts ""
pload QAcommands
box b 10 10 10
incmesh b 0.1
# test the work of distance field
QABVH_DistanceField b 2

View File

@@ -4,4 +4,5 @@
004 extcc
005 2dgcc
006 intss
007 classifier
007 classifier
008 bvh