mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Low-level selection algorithms has been improved to explicitly support 2D transformation persistent objects. This patch generally touches: 1) SelectMgr_SelectableObjectSet - the lists of objects has been split onto three subsets (regular, 3d-persistent, 2d-persistent). Each subset has individual BVH tree. The algorithms are now have more flexibility to update only those trees that is really required for actual camera state. 2) SelectMgr_ViewerSelector - explicitly supports Eye space selection operations on BVH tree for 2d-persistent subset. Change of camera position does not anymore affect acceleration data structure (BVH tree) of 2d-persistent selectable objects. 3) Other classes from SelectMgr have been fine-tuned to provide appropriate API. Porting notes: This patch touches very low-level selection classes. If the low-level features were used the following modifications may need to be considered for porting: 1) Iteration over objects of SelectMgr_SelectableObjectSet should now be implemented with corresponding Iterator class. 2) SelectMgr_BaseFrustum::ScaleAndTransform and derived classes return Handle(SelectMgr_BaseFrustum) instead of NCollection_Handle<> type. Small correction of test case for issue CR27739
82 lines
2.6 KiB
Plaintext
82 lines
2.6 KiB
Plaintext
puts "========"
|
|
puts "OCC27739"
|
|
puts "========"
|
|
puts ""
|
|
##################################################################
|
|
puts "Visualization, TKV3d - implement individual acceleration data structure for selection of 2D persistent objects"
|
|
##################################################################
|
|
|
|
# Create view
|
|
set win_width 409
|
|
set win_height 409
|
|
vinit View1 w=$win_width h=$win_height
|
|
vclear
|
|
|
|
# Display several different presentation types with orthographic camera
|
|
vcamera -ortho
|
|
vtrihedron tri1
|
|
box box3d 100 100 100
|
|
box box2d 100 100 1
|
|
box box2d_pos 100 100 1
|
|
box box2d_loc 100 100 1
|
|
box box_zoom 100 100 100
|
|
|
|
vdisplay box3d -dispMode 1 -highMode 0
|
|
vdisplay box2d -dispMode 1 -highMode 1 -2d
|
|
vdisplay box2d_pos -dispMode 1 -highMode 1 -2d -trsfPersPos -1 -1
|
|
vdisplay box2d_loc -dispMode 1 -highMode 1 -2d
|
|
vdisplay box_zoom -dispMode 1 -highMode 0 -trsfPers zoom
|
|
vdisplay box2d
|
|
vsetlocation box2d_loc 100 0 0
|
|
vsetlocation box_zoom -100 -100 100
|
|
|
|
vsetmaterial box3d box2d box2d_pos box2d_loc box_zoom PLASTIC
|
|
vsetcolor box3d GOLD
|
|
vsetcolor box2d GREEN
|
|
vsetcolor box2d_pos GREEN
|
|
vsetcolor box2d_loc GREEN
|
|
vsetcolor box_zoom RED
|
|
vfit
|
|
|
|
# ==========================================
|
|
# Test selection for orthographic projection
|
|
# ==========================================
|
|
|
|
set test_1 {220 120}; # box2d
|
|
set test_2 {350 150}; # box2d_pos
|
|
set test_3 { 50 350}; # box2d_loc
|
|
|
|
vmoveto {*}$test_1
|
|
if {[vreadpixel {*}$test_1 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" }
|
|
vdump $imagedir/${casename}_1.png
|
|
|
|
vmoveto {*}$test_2
|
|
if {[vreadpixel {*}$test_2 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" }
|
|
vdump $imagedir/${casename}_2.png
|
|
|
|
vmoveto {*}$test_3
|
|
if {[vreadpixel {*}$test_3 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" }
|
|
vdump $imagedir/${casename}_3.png
|
|
|
|
# =========================================
|
|
# Test selection for perspective projection
|
|
# =========================================
|
|
|
|
vcamera -persp
|
|
vcamera -distance 1000
|
|
set test_1 {220 120}; # box2d
|
|
set test_2 {350 150}; # box2d_pos
|
|
set test_3 { 50 350}; # box2d_loc
|
|
|
|
vmoveto {*}$test_1
|
|
if {[vreadpixel {*}$test_1 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" }
|
|
vdump $imagedir/${casename}_4.png
|
|
|
|
vmoveto {*}$test_2
|
|
if {[vreadpixel {*}$test_2 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" }
|
|
vdump $imagedir/${casename}_5.png
|
|
|
|
vmoveto {*}$test_3
|
|
if {[vreadpixel {*}$test_3 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" }
|
|
vdump $imagedir/${casename}_6.png
|