From be480fe7529be547322711e484d1bf37104938e9 Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 8 May 2018 15:32:16 +0300 Subject: [PATCH] 0029744: Visualization - SelectMgr_ViewerSelector::PickedPoint() returns wrong 3D point for objects with transformation persistence SelectMgr_RectangularFrustum::DetectedPoint() now takes into account myScale. --- .../SelectMgr_RectangularFrustum.cxx | 2 +- tests/bugs/vis/bug26304 | 39 ++++++++++--------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/SelectMgr/SelectMgr_RectangularFrustum.cxx b/src/SelectMgr/SelectMgr_RectangularFrustum.cxx index 6b741791ae..82bb7b0607 100644 --- a/src/SelectMgr/SelectMgr_RectangularFrustum.cxx +++ b/src/SelectMgr/SelectMgr_RectangularFrustum.cxx @@ -637,7 +637,7 @@ Standard_Real SelectMgr_RectangularFrustum::DistToGeometryCenter (const gp_Pnt& // ======================================================================= 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; } // ======================================================================= diff --git a/tests/bugs/vis/bug26304 b/tests/bugs/vis/bug26304 index 7c15f86d35..132df257b6 100644 --- a/tests/bugs/vis/bug26304 +++ b/tests/bugs/vis/bug26304 @@ -1,12 +1,8 @@ puts "============" -puts "CR26304" +puts "0026304: Visualization - wrong calculation of point in SelectMgr_RectangularFrustum::DetectedPoint" puts "============" puts "" -########################################################################################## -puts "Visualization - wrong calculation of point in SelectMgr_RectangularFrustum::DetectedPoint" -########################################################################################## - proc findPoint {theInfoString} { puts $theInfoString set aStringArr [split $theInfoString " "] @@ -24,23 +20,30 @@ proc findPoint {theInfoString} { pload VISUALIZATION MODELING +vclear vinit View1 -vsetdispmode 1 -box b 100 100 100 -vdisplay b +box b 100 100 100 +box bz 50 50 50 +vdisplay -dispMode 1 b 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 +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"] -set aPnt [findPoint [lindex $anOut 1]] -vpoint p {*}$aPnt -vfit +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 -vviewparams -scale 22.3 -proj 0.576 -0.78 0.24 -up -0.21 0.136 0.967 -vviewparams -at 10.887 16.807 36.2306 -eye 111.071 -118.34 77.44 - -if {[vreadpixel 103 293 name] != "YELLOW 1"} { - puts "ERROR: Wrong point calculated" -} +if {[vreadpixel 103 293 rgb name] != "YELLOW"} { puts "ERROR: Wrong point calculated" } +if {[vreadpixel 29 24 rgb name] != "YELLOW"} { puts "ERROR: Wrong point calculated" } vdump ${imagedir}/${casename}.png