From 7d46a9ed8b6d5c4e472fe5911b82802efaea6d61 Mon Sep 17 00:00:00 2001 From: vpa Date: Mon, 23 May 2016 19:08:24 +0300 Subject: [PATCH] 0027477: Visualization - Select3D_SensitiveCircle always return infinite depth value in boundary mode - unnecessary re-initialization of pick result was removed from Select3D_SensitiveCircle; - test case for issue #27477 --- src/Select3D/Select3D_SensitiveCircle.cxx | 16 ++++++-- src/Select3D/Select3D_SensitiveCircle.hxx | 6 +++ tests/bugs/vis/bug27477 | 45 +++++++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 tests/bugs/vis/bug27477 diff --git a/src/Select3D/Select3D_SensitiveCircle.cxx b/src/Select3D/Select3D_SensitiveCircle.cxx index e18c80f289..16fff0f0e7 100644 --- a/src/Select3D/Select3D_SensitiveCircle.cxx +++ b/src/Select3D/Select3D_SensitiveCircle.cxx @@ -269,11 +269,12 @@ Standard_Boolean Select3D_SensitiveCircle::Matches (SelectBasics_SelectingVolume thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG); return Standard_False; } + else + { + thePickResult = SelectBasics_PickResult (aDepth, theMgr.DistToGeometryCenter (myCenter3D)); + } } - - aDistToCOG = theMgr.DistToGeometryCenter (myCenter3D); - thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG); return Standard_True; } @@ -369,3 +370,12 @@ gp_Pnt Select3D_SensitiveCircle::CenterOfGeometry() const { return myCenter3D; } + +//======================================================================= +// function : distanceToCOG +// purpose : +//======================================================================= +Standard_Real Select3D_SensitiveCircle::distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) +{ + return theMgr.DistToGeometryCenter (myCenter3D); +} diff --git a/src/Select3D/Select3D_SensitiveCircle.hxx b/src/Select3D/Select3D_SensitiveCircle.hxx index d559c194f6..a5751309b6 100644 --- a/src/Select3D/Select3D_SensitiveCircle.hxx +++ b/src/Select3D/Select3D_SensitiveCircle.hxx @@ -101,6 +101,12 @@ public: DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveCircle,Select3D_SensitivePoly) +protected: + + //! Calculates distance from the 3d projection of used-picked screen point + //! to center of the geometry + virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE; + private: //! Computes myCenter3D as the barycenter of points from mypolyg3d diff --git a/tests/bugs/vis/bug27477 b/tests/bugs/vis/bug27477 new file mode 100644 index 0000000000..17ad57c703 --- /dev/null +++ b/tests/bugs/vis/bug27477 @@ -0,0 +1,45 @@ +puts "============" +puts "OCC27477" +puts "============" +puts "" +#################################################################################### +# Visualization - Select3D_SensitiveCircle always return infinite depth value in boundary mode +#################################################################################### + +proc check_output {theInfo} { + set aSize [llength $theInfo] + for {set i 0} {$i < $aSize} {incr i} { + if {[string equal [lindex $theInfo $i] "Depth:"]} { + set aDepth [lindex $theInfo [expr $i + 1]] + if {[string equal $aDepth "+17.569"]} { + return 1 + } else { + return $aDepth + } + } + } + + return 0 +} + +pload VISUALIZATION + +vinit View1 +vpoint radP1 0 0 0 +vpoint radP2 50 50 0 +vpoint radP3 100 0 0 +vcircle circle radP1 radP2 radP3 0 +vfit + +vmoveto 177 285 +set anOut [split [vstate -entities] "\n"] +set anInfo [split [lindex $anOut 1] " "] +set aResult [check_output $anInfo] +if {$aResult == 1} { + puts "OK" + } else { + puts "ERROR: the depth value is incorrect: should be +17.569, but is equal to:" + puts $aResult + } + +set only_screen 1 -- 2.20.1