1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0029744: Visualization - SelectMgr_ViewerSelector::PickedPoint() returns wrong 3D point for objects with transformation persistence

SelectMgr_RectangularFrustum::DetectedPoint() now takes into account myScale.
This commit is contained in:
kgv 2018-05-08 15:32:16 +03:00 committed by abv
parent 0e4e721c6b
commit be480fe752
2 changed files with 22 additions and 19 deletions

View File

@ -637,7 +637,7 @@ Standard_Real SelectMgr_RectangularFrustum::DistToGeometryCenter (const gp_Pnt&
// ======================================================================= // =======================================================================
gp_Pnt SelectMgr_RectangularFrustum::DetectedPoint (const Standard_Real theDepth) const gp_Pnt SelectMgr_RectangularFrustum::DetectedPoint (const Standard_Real theDepth) const
{ {
return myNearPickedPnt.XYZ() + myViewRayDir.Normalized().XYZ() * theDepth; return myNearPickedPnt.XYZ() + myViewRayDir.Normalized().XYZ() * theDepth / myScale;
} }
// ======================================================================= // =======================================================================

View File

@ -1,12 +1,8 @@
puts "============" puts "============"
puts "CR26304" puts "0026304: Visualization - wrong calculation of point in SelectMgr_RectangularFrustum::DetectedPoint"
puts "============" puts "============"
puts "" puts ""
##########################################################################################
puts "Visualization - wrong calculation of point in SelectMgr_RectangularFrustum::DetectedPoint"
##########################################################################################
proc findPoint {theInfoString} { proc findPoint {theInfoString} {
puts $theInfoString puts $theInfoString
set aStringArr [split $theInfoString " "] set aStringArr [split $theInfoString " "]
@ -24,23 +20,30 @@ proc findPoint {theInfoString} {
pload VISUALIZATION MODELING pload VISUALIZATION MODELING
vclear
vinit View1 vinit View1
vsetdispmode 1
box b 100 100 100 box b 100 100 100
vdisplay b box bz 50 50 50
vdisplay -dispMode 1 b
vfit vfit
vdisplay -dispMode 1 -trsfPers zoom -trsfPersPos 0 -10 50 bz
vaspects bz -setColor GREEN -setTransparency 0.5
vselect 20 200
set anOut1 [split [vstate -entities] "\n"]
set aPnt1 [findPoint [lindex $anOut1 1]]
# expected 4.78109 -10 59.1192
vpoint p1 {*}$aPnt1
vselect 48 258 vselect 48 258
set anOut2 [split [vstate -entities] "\n"]
set aPnt2 [findPoint [lindex $anOut2 1]]
# expected 10.7493 0 28.4578
vpoint p {*}$aPnt2
set anOut [split [vstate -entities] "\n"] vviewparams -scale 22.3 -proj 0.578415 -0.780275 0.237924 -up -0.212025 0.137838 0.967495 -at 10.887 16.807 36.2306
set aPnt [findPoint [lindex $anOut 1]]
vpoint p {*}$aPnt
vfit
vviewparams -scale 22.3 -proj 0.576 -0.78 0.24 -up -0.21 0.136 0.967 if {[vreadpixel 103 293 rgb name] != "YELLOW"} { puts "ERROR: Wrong point calculated" }
vviewparams -at 10.887 16.807 36.2306 -eye 111.071 -118.34 77.44 if {[vreadpixel 29 24 rgb name] != "YELLOW"} { puts "ERROR: Wrong point calculated" }
if {[vreadpixel 103 293 name] != "YELLOW 1"} {
puts "ERROR: Wrong point calculated"
}
vdump ${imagedir}/${casename}.png vdump ${imagedir}/${casename}.png