]> OCCT Git - occt.git/commitdiff
0032388: Visualization - provide ray-picking interface with zero tolerance for rectan...
authorosa <osa@opencascade.com>
Tue, 25 May 2021 14:57:48 +0000 (17:57 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 26 May 2021 17:07:41 +0000 (20:07 +0300)
src/Select3D/Select3D_SensitiveEntity.hxx
src/SelectMgr/SelectMgr_RectangularFrustum.cxx
src/SelectMgr/SelectMgr_SelectionManager.cxx
src/SelectMgr/SelectMgr_ToleranceMap.cxx
src/SelectMgr/SelectMgr_ToleranceMap.hxx
src/ViewerTest/ViewerTest.cxx
tests/vselect/axis/A3 [new file with mode: 0644]

index 3015a14d5b52e4970a7dd5f5a904201ac78fb554..1d745239a1718d2766061adfe573bb5d8591d454 100644 (file)
@@ -50,7 +50,7 @@ public:
   //! Allows to manage sensitivity of a particular sensitive entity
   void SetSensitivityFactor (const Standard_Integer theNewSens)
   {
-    Standard_ASSERT_RAISE (theNewSens > 0, "Error! Selection sensitivity have positive value.");
+    Standard_ASSERT_RAISE (theNewSens >= 0, "Error! Selection sensitivity should not be negative value.");
     mySFactor = theNewSens;
   }
 
index 1cd8dff2d4eecdb9b6e8326b063269b23c43e299..071cf1b2597ad7f012d2a7fd6e68c435e3e6c3b8 100644 (file)
@@ -364,8 +364,8 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_RectangularFrustum::ScaleAndTransfor
   Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point || mySelectionType == SelectMgr_SelectionType_Box,
     "Error! SelectMgr_RectangularFrustum::ScaleAndTransform() should be called after selection frustum initialization");
 
-  Standard_ASSERT_RAISE (theScaleFactor > 0,
-    "Error! Pixel tolerance for selection should be greater than zero");
+  Standard_ASSERT_RAISE (theScaleFactor >= 0,
+    "Error! Pixel tolerance for selection should not be negative");
 
   Handle(SelectMgr_RectangularFrustum) aRes = new SelectMgr_RectangularFrustum();
   const Standard_Boolean isToScale = theScaleFactor != 1;
index 5aaad68ab4d0ca465d6362c2d2af9ec4b4e47406..8ba04c4b15bd09ddaa2fca7525a2d0d5277eea35 100644 (file)
@@ -574,7 +574,7 @@ void SelectMgr_SelectionManager::SetSelectionSensitivity (const Handle(SelectMgr
                                                           const Standard_Integer theMode,
                                                           const Standard_Integer theNewSens)
 {
-  Standard_ASSERT_RAISE (theNewSens > 0, "Error! Selection sensitivity have positive value.");
+  Standard_ASSERT_RAISE (theNewSens >= 0, "Error! Selection sensitivity should not be negative value.");
   if (theObject.IsNull())
   {
     return;
index bdea8cc48899e73c906024af64477ef6bda6cbee..9246063ff1bca3af1b7702c9918d693e7619c4e1 100644 (file)
@@ -78,7 +78,7 @@ void SelectMgr_ToleranceMap::Decrement (const Standard_Integer& theTolerance)
   if (theTolerance == myLargestKey
   && *aFreq == 0)
   {
-    myLargestKey = 0;
+    myLargestKey = -1;
     for (NCollection_DataMap<Standard_Integer, Standard_Integer>::Iterator anIter (myTolerances); anIter.More(); anIter.Next())
     {
       if (anIter.Value() != 0)
index 098cef202ebf2574addc4532889d077175404c70..1af12cc0825910b6840d5b8a21b473b61c9bc29c 100644 (file)
@@ -40,7 +40,7 @@ public:
   //! Returns a current tolerance that must be applied
   Standard_Integer Tolerance() const
   {
-    if (myLargestKey < Precision::Confusion())
+    if (myLargestKey < 0)
     {
       return 2; // default tolerance value
     }
index 4393c5c3c383834410090585cc54388a3fb6bef8..34bdb9f079ed89d8c994f4b80c7ed44ae60db3c2 100644 (file)
@@ -1898,9 +1898,9 @@ struct ViewerTest_AspectsChangeSet
       Message::SendFail() << "Error: the max parameter value should be greater than zero (specified " << MaxParamValue << ")";
       isOk = Standard_False;
     }
-    if (Sensitivity <= 0 && ToSetSensitivity)
+    if (Sensitivity < 0 && ToSetSensitivity)
     {
-      Message::SendFail() << "Error: sensitivity parameter value should be positive (specified " << Sensitivity << ")";
+      Message::SendFail() << "Error: sensitivity parameter value should not be negative (specified " << Sensitivity << ")";
       isOk = Standard_False;
     }
     if (ToSetHatch == 1 && StdHatchStyle < 0 && PathToHatchPattern == "")
diff --git a/tests/vselect/axis/A3 b/tests/vselect/axis/A3
new file mode 100644 (file)
index 0000000..88aa421
--- /dev/null
@@ -0,0 +1,55 @@
+puts "========"
+puts "0032388: Visualization - provide ray-picking interface with zero tolerance for rectangular frustum"
+puts "========"
+puts ""
+
+pload MODELING VISUALIZATION
+box b 100 200 300
+vinit View1
+puts "Display box"
+vdisplay -dispMode 1 b
+vfit
+vselprops -pixtol 0
+vaspects b -sensitivity 0 4
+set box_sens4 [vmoveto 321 319]
+vdump ${imagedir}/${casename}_box_sens4.png
+regexp {([-0-9.+eE]+ [-0-9.+eE]+ [-0-9.+eE]+)} ${box_sens4} full p
+checkpoint "box_sens4" $p {100 200 0} 0.001
+vaspects b -sensitivity 0 0
+set box_sens0_out [vmoveto 321 319]
+vdump ${imagedir}/${casename}_box_sens0_out.png
+if {[string first "e+308" $box_sens0_out] == -1} {
+  puts "Faulty : Selection of box with sensitivity 0"
+}
+set box_sens0_in [vmoveto 319 317]
+vdump ${imagedir}/${casename}_box_sens0_in.png
+regexp {([-0-9.+eE]+ [-0-9.+eE]+ [-0-9.+eE]+)} ${box_sens0_in} full p
+checkpoint "box_sens0_in" $p {100.00000000000003 196.92152736525867 0.4127082000112523} 0.001
+
+puts ""
+puts "Display 2d point"
+vpoint p 320 318 -2d
+vaspects p -markerType .
+set point_sens12_out [vmoveto 321 319]
+vdump ${imagedir}/${casename}_point_sens12_out.png
+regexp {([-0-9.+eE]+ [-0-9.+eE]+ [-0-9.+eE]+)} ${point_sens12_out} full p
+checkpoint "point_sens12_out" $p {104.7974449617403 -102.98278630143884 -346.41016151377545} 0.001
+set point_sens12_in [vmoveto 319 317]
+vdump ${imagedir}/${casename}_point_sens12_in.png
+regexp {([-0-9.+eE]+ [-0-9.+eE]+ [-0-9.+eE]+)} ${point_sens12_in} full p
+checkpoint "point_sens12_in" $p {104.7974449617403 -102.98278630143884 -346.41016151377545} 0.001
+vaspects p -sensitivity 0 0
+set point_sens0_out [vmoveto 321 319]
+vdump ${imagedir}/${casename}_point_sens0_out.png
+if {[string first "e+308" $point_sens0_out] == -1} {
+  puts "Faulty : Selection of point with sensitivity 0"
+}
+set point_sens0_eq [vmoveto 320 318]
+vdump ${imagedir}/${casename}_point_sens0_eq.png
+if {[string first "e+308" $point_sens0_eq] == -1} {
+  puts "Faulty : Selection of point with sensitivity 0"
+}
+set point_sens0_in [vmoveto 319 317]
+vdump ${imagedir}/${casename}_point_sens0_in.png
+regexp {([-0-9.+eE]+ [-0-9.+eE]+ [-0-9.+eE]+)} ${point_sens0_in} full p
+checkpoint "point_sens0_in" $p {100.00000000000003 196.92152736525867 0.41270820001116704} 0.001