]> OCCT Git - occt-copy.git/commitdiff
0023705: Isoline in the AIS viewer is not trimmed
authorskv <skv@opencascade.com>
Fri, 8 Feb 2013 13:53:02 +0000 (17:53 +0400)
committerskv <skv@opencascade.com>
Fri, 22 Feb 2013 13:18:21 +0000 (17:18 +0400)
Signed-off-by: skv <skv@opencascade.com>
src/StdPrs/StdPrs_WFDeflectionRestrictedFace.cxx
src/ViewerTest/ViewerTest.cxx
tests/bugs/vis/bug23705 [new file with mode: 0755]

index 2a473f7a5fd674ee000aa22aff3e08bdac641cd9..87f1ad4a34432ad288f19ebe7a25cd76cfd85d0e 100755 (executable)
@@ -146,6 +146,7 @@ void StdPrs_WFDeflectionRestrictedFace::Add
   gp_Pnt dummypnt;
   Standard_Real ddefle= Max(UMax-UMin, VMax-VMin) * aDrawer->DeviationCoefficient();
   TColgp_SequenceOfPnt2d tabP;
+  Standard_Real aHatchingTol = 1.e100;
 
   UMin = VMin = 1.e100;
   UMax = VMax = -1.e100;
@@ -173,6 +174,7 @@ void StdPrs_WFDeflectionRestrictedFace::Add
              UMax = Max(P2.X(), UMax);
              VMin = Min(P2.Y(), VMin);
              VMax = Max(P2.Y(), VMax);
+              aHatchingTol = Min(P1.SquareDistance(P2), aHatchingTol);
 
              if(Orient == TopAbs_FORWARD ) {
                //isobuild.Trim(P1,P2);
@@ -219,6 +221,8 @@ void StdPrs_WFDeflectionRestrictedFace::Add
        UMax = Max(P2.X(), UMax);
        VMin = Min(P2.Y(), VMin);
        VMax = Max(P2.Y(), VMax);
+        aHatchingTol = Min(P1.SquareDistance(P2), aHatchingTol);
+
        if(Orient == TopAbs_FORWARD ) {
         // isobuild.Trim(P1,P2);
          tabP.Append(P1);
@@ -240,8 +244,13 @@ void StdPrs_WFDeflectionRestrictedFace::Add
   FFaceTimer2.Start();
 #endif
 
+  // Compute the hatching tolerance.
+  aHatchingTol *= 0.1;
+  aHatchingTol = Max(Precision::Confusion(), aHatchingTol);
+  aHatchingTol = Min(1.e-5, aHatchingTol);
+
   // load the isos
-  Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
+  Hatch_Hatcher isobuild(aHatchingTol, ToolRst.IsOriented());
   Standard_Boolean UClosed = aFace->IsUClosed();
   Standard_Boolean VClosed = aFace->IsVClosed();
 
index d017497813131625a0378ac56dc370445b86fea8..2eefcd809c8d51de8f41991ab4cf2addd5fa39a1 100755 (executable)
@@ -56,6 +56,7 @@
 #include <Graphic3d_AspectFillArea3d.hxx>
 #include <Image_AlienPixMap.hxx>
 #include <Prs3d_ShadingAspect.hxx>
+#include <Prs3d_IsoAspect.hxx>
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -3556,6 +3557,10 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
   const char *group = "AIS_Display";
 
   // display
+  theCommands.Add("visos",
+                  "visos [name1 ...] [nbUIsos nbVIsos IsoOnPlane(0|1)]\n"
+                  "\tIf last 3 optional parameters are not set prints numbers of U-, V- isolines and IsoOnPlane.\n",
+                 __FILE__, visos, group);
 
   theCommands.Add("vdisplay",
                  "vdisplay         : vdisplay2 name1 [name2] ... [name n] ",
diff --git a/tests/bugs/vis/bug23705 b/tests/bugs/vis/bug23705
new file mode 100755 (executable)
index 0000000..c5c35cb
--- /dev/null
@@ -0,0 +1,22 @@
+puts "========"
+puts "CR23705"
+puts "========"
+puts ""
+###############################################################
+## Isoline in the AIS viewer is not trimmed
+###############################################################
+
+restore [locate_data_file bug23705_plancher20igs_face.brep] result
+
+vinit
+visos 10 10 1
+
+vdisplay result
+vfit
+
+set x 326
+set y 295
+
+checkcolor $x $y 0 0 0
+
+set only_screen 1