0023200: Visualization - prevent multiple triangulating of a shape that already has...
authorosa <osa@opencascade.com>
Thu, 5 Mar 2015 11:48:42 +0000 (14:48 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 5 Mar 2015 11:49:32 +0000 (14:49 +0300)
Add new flag IsAutoTriangulated to Prs3d_Drawer. It is True by default.
If this flag is True automatic re-triangulation with deflection-check logic will be applied.
Else this feature will be disable and triangulation is expected to be computed by application itself.

Change the syntax of vdefalts command.
Add new parameter -autoTriang for check of AutoTriangulated functionality.

Adjust camera position in test case bugs/xde/bug23969

19 files changed:
src/AIS/AIS_ColoredShape.cxx
src/AIS/AIS_ConnectedInteractive.cxx
src/AIS/AIS_Shape.cxx
src/AIS/AIS_TexturedShape.cxx
src/Prs3d/Prs3d_Drawer.cxx
src/Prs3d/Prs3d_Drawer.hxx
src/StdPrs/StdPrs_HLRPolyShape.cxx
src/StdPrs/StdPrs_ShadedShape.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx
tests/bugs/vis/bug21753
tests/bugs/vis/bug23200 [new file with mode: 0644]
tests/bugs/vis/bug23200_1 [new file with mode: 0644]
tests/bugs/vis/bug23886_1
tests/bugs/vis/bug23886_2
tests/bugs/vis/bug23886_3
tests/bugs/xde/bug23969
tests/v3d/glsl/phong_couple
tests/v3d/glsl/phong_fuse
tests/v3d/glsl/phong_fuse2

index 7e31948..5d0f8d9 100644 (file)
@@ -308,16 +308,19 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
 
   if (theMode == AIS_Shaded)
   {
-    // compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
-    Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
-    Standard_Boolean isOwnDeviationAngle       = OwnDeviationAngle      (anAngleNew, anAnglePrev);
-    Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew,  aCoeffPrev);
-    if ((isOwnDeviationAngle       && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
-     || (isOwnDeviationCoefficient && Abs (aCoeffNew  - aCoeffPrev)  > Precision::Confusion()))
+    if (myDrawer->IsAutoTriangulation())
     {
-      BRepTools::Clean (myshape);
+      // compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
+      Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
+      Standard_Boolean isOwnDeviationAngle       = OwnDeviationAngle      (anAngleNew, anAnglePrev);
+      Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew,  aCoeffPrev);
+      if ((isOwnDeviationAngle       && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
+       || (isOwnDeviationCoefficient && Abs (aCoeffNew  - aCoeffPrev)  > Precision::Confusion()))
+      {
+        BRepTools::Clean (myshape);
+      }
+      StdPrs_ShadedShape::Tessellate (myshape, myDrawer);
     }
-    StdPrs_ShadedShape::Tessellate (myshape, myDrawer);
   }
 
   TopoDS_Compound anOpened, aClosed;
index 10a7368..9a4fef7 100644 (file)
@@ -225,7 +225,8 @@ void AIS_ConnectedInteractive::Compute (const Handle(Prs3d_Projector)& theProjec
       // process HLRAngle and HLRDeviationCoefficient()
       Standard_Real aPrevAngle = myDrawer->HLRAngle();
       Standard_Real aNewAngle = aDefaultDrawer->HLRAngle();
-      if (Abs (aNewAngle - aPrevAngle) > Precision::Angular())
+      if (myDrawer->IsAutoTriangulation() &&
+          Abs (aNewAngle - aPrevAngle) > Precision::Angular())
       {
         BRepTools::Clean (theShape);
       }
index 668dfe3..b05772d 100644 (file)
@@ -165,13 +165,16 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
   }
   case 1:
     {
-      Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
-      Standard_Boolean isOwnDeviationAngle       = OwnDeviationAngle      (anAngleNew, anAnglePrev);
-      Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew,  aCoeffPrev);
-      if ((isOwnDeviationAngle       && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
-       || (isOwnDeviationCoefficient && Abs (aCoeffNew  - aCoeffPrev)  > Precision::Confusion()))
+      if (myDrawer->IsAutoTriangulation())
       {
-        BRepTools::Clean (myshape);
+        Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
+        Standard_Boolean isOwnDeviationAngle       = OwnDeviationAngle      (anAngleNew, anAnglePrev);
+        Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew,  aCoeffPrev);
+        if ((isOwnDeviationAngle       && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
+         || (isOwnDeviationCoefficient && Abs (aCoeffNew  - aCoeffPrev)  > Precision::Confusion()))
+        {
+          BRepTools::Clean (myshape);
+        }
       }
 
       //shading only on face...
@@ -259,20 +262,18 @@ void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
   Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
   defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
 
-// coefficients for calculation
-
-  Standard_Real prevangle, newangle ,prevcoeff,newcoeff ; 
-  Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle(newangle,prevangle);
-  Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient(newcoeff,prevcoeff);
-  if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnHLRDeviationAngle) ||
-      ((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient)) {
-#ifdef OCCT_DEBUG
-      cout << "AIS_Shape : compute"<<endl;
-      cout << "newangle  : " << newangle << " # de " << "prevangl  : " << prevangle << " OU "<<endl;
-      cout << "newcoeff  : " << newcoeff << " # de " << "prevcoeff : " << prevcoeff << endl;
-#endif
+  if (myDrawer->IsAutoTriangulation())
+  {
+    // coefficients for calculation
+    Standard_Real aPrevAngle, aNewAngle, aPrevCoeff, aNewCoeff;
+    Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle (aNewAngle, aPrevAngle);
+    Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient (aNewCoeff, aPrevCoeff);
+    if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnHLRDeviationAngle) ||
+        ((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient))
+    {
       BRepTools::Clean(SH);
     }
+  }
   
   {
     try {
@@ -381,7 +382,6 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
 // POP protection against crash in low layers
 
   Standard_Real aDeflection = Prs3d::GetDeflection(shape, myDrawer);
-  Standard_Boolean autoTriangulation = Standard_True;
   try {  
     OCC_CATCH_SIGNALS
     StdSelect_BRepSelectionTool::Load(aSelection,
@@ -390,7 +390,7 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
                                       TypOfSel,
                                       aDeflection,
                                       myDrawer->HLRAngle(),
-                                      autoTriangulation); 
+                                      myDrawer->IsAutoTriangulation());
   } catch ( Standard_Failure ) {
 //    cout << "a Shape should be incorrect : A Selection on the Bnd  is activated   "<<endl;
     if ( aMode == 0 ) {
index ca9845c..0f87d78 100644 (file)
@@ -429,16 +429,20 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
     case AIS_Shaded:
     case 3: // texture mapping on triangulation
     {
-      Standard_Real prevangle;
-      Standard_Real newangle;
-      Standard_Real prevcoeff;
-      Standard_Real newcoeff;
-
-      Standard_Boolean isOwnDeviationAngle       = OwnDeviationAngle(newangle,prevangle);
-      Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff);
-      if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) ||
-          ((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) {
-        BRepTools::Clean (myshape);
+      if (myDrawer->IsAutoTriangulation())
+      {
+        Standard_Real aPrevAngle;
+        Standard_Real aNewAngle;
+        Standard_Real aPrevCoeff;
+        Standard_Real aNewCoeff;
+
+        Standard_Boolean isOwnDeviationAngle       = OwnDeviationAngle (aNewAngle, aPrevAngle);
+        Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient (aNewCoeff,aPrevCoeff);
+        if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnDeviationAngle) ||
+            ((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnDeviationCoefficient))
+        {
+          BRepTools::Clean (myshape);
+        }
       }
 
       if (myshape.ShapeType() > TopAbs_FACE)
index 71b2a6e..9fd5643 100644 (file)
@@ -50,6 +50,8 @@ Prs3d_Drawer::Prs3d_Drawer()
   myHasOwnHLRDeviationAngle       (Standard_False),
   myIsoOnPlane                    (Standard_False),
   myHasOwnIsoOnPlane              (Standard_False),
+  myIsAutoTriangulated            (Standard_True),
+  myHasOwnIsAutoTriangulated      (Standard_False),
 
   myHasOwnUIsoAspect          (Standard_False),
   myHasOwnVIsoAspect          (Standard_False),
@@ -229,6 +231,17 @@ void Prs3d_Drawer::SetHLRAngle (const Standard_Real theAngle)
   myHasOwnHLRDeviationAngle   = Standard_True;
 }
 
+// =======================================================================
+// function : SetAutoTriangulation
+// purpose  :
+// =======================================================================
+
+void Prs3d_Drawer::SetAutoTriangulation (const Standard_Boolean theIsEnabled)
+{
+  myHasOwnIsAutoTriangulated = Standard_True;
+  myIsAutoTriangulated       = theIsEnabled;
+}
+
 // =======================================================================
 // function : FreeBoundaryAspect
 // purpose  :
@@ -1027,6 +1040,7 @@ void Prs3d_Drawer::ClearLocalAttributes()
   myHasOwnDeviationAngle          = Standard_False;
   myHasOwnHLRDeviationAngle       = Standard_False;
   myHasOwnIsoOnPlane              = Standard_False;
+  myHasOwnIsAutoTriangulated      = Standard_False;
   myHasOwnWireDraw                = Standard_False;
   myHasOwnShadingAspectGlobal     = Standard_False;
   myHasOwnLineArrowDraw           = Standard_False;
index 58232df..6ac8d54 100644 (file)
@@ -309,6 +309,23 @@ public:
          : 0.0;
   }
 
+  //! Sets IsAutoTriangulated on or off by setting the parameter theIsEnabled to true or false.
+  //! If this flag is True automatic re-triangulation with deflection-check logic will be applied.
+  //! Else this feature will be disable and triangulation is expected to be computed by application itself
+  //! and no shading presentation at all if unavailable.
+  Standard_EXPORT void SetAutoTriangulation (const Standard_Boolean theIsEnabled);
+
+  //! Returns True if automatic triangulation is enabled.
+  Standard_Boolean IsAutoTriangulation() const
+  {
+    return HasOwnIsAutoTriangulation() || myLink.IsNull()
+         ? myIsAutoTriangulated
+         : myLink->IsAutoTriangulation();
+  }
+
+  //! Returns true if the drawer has IsoOnPlane setting active.
+  Standard_Boolean HasOwnIsAutoTriangulation() const { return myHasOwnIsAutoTriangulated; }
+
   //! Defines the attributes which are used when drawing an
   //! U isoparametric curve of a face. Defines the number
   //! of U isoparametric curves to be drawn for a single face.
@@ -840,6 +857,8 @@ protected:
   Standard_Real                 myPreviousHLRDeviationAngle;
   Standard_Boolean              myIsoOnPlane;
   Standard_Boolean              myHasOwnIsoOnPlane;
+  Standard_Boolean              myIsAutoTriangulated;
+  Standard_Boolean              myHasOwnIsAutoTriangulated;
 
   Handle(Prs3d_IsoAspect)       myUIsoAspect;
   Standard_Boolean              myHasOwnUIsoAspect;
index cddcff8..ef05b62 100644 (file)
@@ -64,9 +64,12 @@ void StdPrs_HLRPolyShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
   TColgp_SequenceOfPnt HiddenPnts;
   TColgp_SequenceOfPnt SeenPnts;
 
-  const Standard_Boolean rel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
-  Standard_Real def = rel? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation();
-  BRepMesh_IncrementalMesh mesh(aShape, def, rel, aDrawer->HLRAngle());
+  if (aDrawer->IsAutoTriangulation())
+  {
+    const Standard_Boolean aRel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
+    Standard_Real aDef = aRel ? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation();
+    BRepMesh_IncrementalMesh mesh(aShape, aDef, aRel, aDrawer->HLRAngle());
+  }
   
   Handle(HLRBRep_PolyAlgo) hider = new HLRBRep_PolyAlgo(aShape);
 
index 444d4d4..3ddef99 100644 (file)
@@ -33,6 +33,7 @@
 #include <Precision.hxx>
 #include <Prs3d.hxx>
 #include <Prs3d_Drawer.hxx>
+#include <Prs3d_IsoAspect.hxx>
 #include <Prs3d_LineAspect.hxx>
 #include <Prs3d_Presentation.hxx>
 #include <Prs3d_ShadingAspect.hxx>
@@ -40,6 +41,7 @@
 #include <Poly_PolygonOnTriangulation.hxx>
 #include <Poly_Triangulation.hxx>
 #include <StdPrs_ToolShadedShape.hxx>
+#include <StdPrs_WFDeflectionShape.hxx>
 #include <StdPrs_WFShape.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
@@ -105,6 +107,42 @@ namespace
     }
   }
 
+  //! Computes special wireframe presentation for faces without triangulation.
+  void wireframeNoTriangFacesFromShape (const Handle(Prs3d_Presentation)& thePrs,
+                                        const TopoDS_Shape&               theShape,
+                                        const Handle(Prs3d_Drawer)&       theDrawer)
+  {
+    TopoDS_Compound aCompoundWF;
+    BRep_Builder aBuilder;
+    aBuilder.MakeCompound (aCompoundWF);
+    TopLoc_Location aLoc;
+    Standard_Boolean hasElement = Standard_False;
+
+    for (TopExp_Explorer aShapeIter(theShape, TopAbs_FACE); aShapeIter.More(); aShapeIter.Next())
+    {
+      const TopoDS_Face& aFace = TopoDS::Face (aShapeIter.Current());
+      const Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation (aFace, aLoc);
+      if (aTriang.IsNull())
+      {
+        hasElement = Standard_True;
+        aBuilder.Add (aCompoundWF, aFace);
+      }
+    }
+
+    if (hasElement)
+    {
+      Standard_Integer aPrevUIsoNb = theDrawer->UIsoAspect()->Number();
+      Standard_Integer aPrevVIsoNb = theDrawer->VIsoAspect()->Number();
+      theDrawer->UIsoAspect()->SetNumber (5);
+      theDrawer->VIsoAspect()->SetNumber (5);
+
+      StdPrs_WFDeflectionShape::Add (thePrs, aCompoundWF, theDrawer);
+
+      theDrawer->UIsoAspect()->SetNumber (aPrevUIsoNb);
+      theDrawer->VIsoAspect()->SetNumber (aPrevVIsoNb);
+    }
+  }
+
   //! Gets triangulation of every face of shape and fills output array of triangles
   static Handle(Graphic3d_ArrayOfTriangles) fillTriangles (const TopoDS_Shape&    theShape,
                                                            const Standard_Boolean theHasTexels,
@@ -504,8 +542,15 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
   // add wireframe presentation for isolated edges and vertices
   wireframeFromShape (thePrs, theShape, theDrawer);
 
-  // Triangulation completeness is important for "open-closed" analysis - perform tessellation beforehand
-  Tessellate (theShape, theDrawer);
+  // Use automatic re-triangulation with deflection-check logic only if this feature is enable
+  if (theDrawer->IsAutoTriangulation())
+  {
+    // Triangulation completeness is important for "open-closed" analysis - perform tessellation beforehand
+    Tessellate (theShape, theDrawer);
+  }
+
+  // add special wireframe presentation for faces without triangulation
+  wireframeNoTriangFacesFromShape (thePrs, theShape, theDrawer);
 
   // The shape types listed below need advanced analysis as potentially containing
   // both closed and open parts. Solids are also included, because they might
index cd0a073..009b8ef 100644 (file)
@@ -6620,44 +6620,74 @@ static int VDefaults (Draw_Interpretor& theDi,
             << "AbsoluteDeflection: " << aDefParams->MaximalChordialDeviation() << "\n";
     }
     theDi << "AngularDeflection:  " << (180.0 * aDefParams->HLRAngle() / M_PI) << "\n";
+    theDi << "AutoTriangulation:  " << (aDefParams->IsAutoTriangulation() ? "on" : "off") << "\n";
     return 0;
   }
 
   for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
   {
     TCollection_AsciiString anArg (theArgVec[anArgIter]);
-    TCollection_AsciiString aKey, aValue;
-    if (!ViewerTest::SplitParameter (anArg, aKey, aValue)
-     || aValue.IsEmpty())
-    {
-      std::cerr << "Error, wrong syntax at: '" << anArg.ToCString() << "'!\n";
-      return 1;
-    }
-
-    aKey.UpperCase();
-    if (aKey == "ABSDEFL"
-     || aKey == "ABSOLUTEDEFLECTION"
-     || aKey == "DEFL"
-     || aKey == "DEFLECTION")
+    anArg.UpperCase();
+    if (anArg == "-ABSDEFL"
+     || anArg == "-ABSOLUTEDEFLECTION"
+     || anArg == "-DEFL"
+     || anArg == "-DEFLECTION")
     {
+      if (++anArgIter >= theArgsNb)
+      {
+        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        return 1;
+      }
       aDefParams->SetTypeOfDeflection         (Aspect_TOD_ABSOLUTE);
-      aDefParams->SetMaximalChordialDeviation (aValue.RealValue());
+      aDefParams->SetMaximalChordialDeviation (Draw::Atof (theArgVec[anArgIter]));
     }
-    else if (aKey == "RELDEFL"
-          || aKey == "RELATIVEDEFLECTION"
-          || aKey == "DEVCOEFF"
-          || aKey == "DEVIATIONCOEFF"
-          || aKey == "DEVIATIONCOEFFICIENT")
+    else if (anArg == "-RELDEFL"
+          || anArg == "-RELATIVEDEFLECTION"
+          || anArg == "-DEVCOEFF"
+          || anArg == "-DEVIATIONCOEFF"
+          || anArg == "-DEVIATIONCOEFFICIENT")
     {
+      if (++anArgIter >= theArgsNb)
+      {
+        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        return 1;
+      }
       aDefParams->SetTypeOfDeflection     (Aspect_TOD_RELATIVE);
-      aDefParams->SetDeviationCoefficient (aValue.RealValue());
+      aDefParams->SetDeviationCoefficient (Draw::Atof (theArgVec[anArgIter]));
     }
-    else if (aKey == "ANGDEFL"
-          || aKey == "ANGULARDEFL"
-          || aKey == "ANGULARDEFLECTION")
+    else if (anArg == "-ANGDEFL"
+          || anArg == "-ANGULARDEFL"
+          || anArg == "-ANGULARDEFLECTION")
     {
+      if (++anArgIter >= theArgsNb)
+      {
+        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        return 1;
+      }
       // currently HLRDeviationAngle is used instead of DeviationAngle in most places
-      aDefParams->SetHLRAngle (M_PI * aValue.RealValue() / 180.0);
+      aDefParams->SetHLRAngle (M_PI * Draw::Atof (theArgVec[anArgIter]) / 180.0);
+    }
+    if (anArg == "-AUTOTR"
+     || anArg == "-AUTOTRIANG"
+     || anArg == "-AUTOTRIANGULATION")
+    {
+      if (++anArgIter >= theArgsNb)
+      {
+        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        return 1;
+      }
+      TCollection_AsciiString aValue (theArgVec[anArgIter]);
+      aValue.LowerCase();
+      if (aValue == "on"
+       || aValue == "1")
+      {
+        aDefParams->SetAutoTriangulation (Standard_True);
+      }
+      else if (aValue == "off"
+            || aValue == "0")
+      {
+        aDefParams->SetAutoTriangulation (Standard_False);
+      }
     }
     else
     {
@@ -7969,8 +7999,11 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "  this command sets texture details mode for the specified view.\n"
     , __FILE__, VSetTextureMode, group);
   theCommands.Add("vdefaults",
-    "vdefaults [absDefl=value] [devCoeff=value] [angDefl=value]",
-    __FILE__, VDefaults, group);
+               "vdefaults [-absDefl value]"
+       "\n\t\t:           [-devCoeff value]"
+       "\n\t\t:           [-angDefl value]"
+       "\n\t\t:           [-autoTriang {off/on | 0/1}]"
+    , __FILE__, VDefaults, group);
   theCommands.Add("vlight",
     "tool to manage light sources, without arguments shows list of lights."
     "\n    Main commands: "
index 19b790b..5bd92c3 100644 (file)
@@ -7,7 +7,7 @@ puts "=================================="
 
 # set rough meshing parameters
 vinit
-vdefaults absDefl=10 devCoeff=0.1
+vdefaults -absDefl 10 -devCoeff 0.1
 
 puts "Displaying two equal cones, one with Phong shader"
 pcone p_gouraud 10 100 100
diff --git a/tests/bugs/vis/bug23200 b/tests/bugs/vis/bug23200
new file mode 100644 (file)
index 0000000..a1378a8
--- /dev/null
@@ -0,0 +1,54 @@
+puts "============"
+puts "CR23200"
+puts "Check that the shape is automatic re-triangulated with deflection-check logic"
+puts "in case of enabled auto triangulation feature (its own triangulation can be lost)."
+puts "And it keeps its already computed triangulation"
+puts "in case of disabled auto triangulation feature."
+puts "============"
+puts ""
+
+set aDefaultShape $imagedir/${casename}_shape.png
+set aShapeAutoTr $imagedir/${casename}_shape_auto_triangulation.png
+set aShapeNotAutoTr $imagedir/${casename}_shape_not_auto_triangulation.png
+
+vinit View1
+vclear
+vaxo
+vsetdispmode 1
+vdefaults -autoTriang on
+psphere s 0.5
+vdisplay s
+vfit
+vdump $aDefaultShape
+
+vclear
+tclean s
+incmesh s 0.1 -a 45
+set tri_info [trinfo s]
+regexp { +([-0-9.+eE]+) +triangles} $tri_info full triIncmesh1
+
+vdisplay s
+set tri_info [trinfo s]
+regexp { +([-0-9.+eE]+) +triangles} $tri_info full triAutoTrShape
+vfit
+vdump $aShapeAutoTr
+
+vclear
+vdefaults -autoTriang off
+tclean  s
+incmesh s 0.1 -a 45
+set tri_info [trinfo s]
+regexp { +([-0-9.+eE]+) +triangles} $tri_info full triIncmesh2
+
+vdisplay s
+set tri_info [trinfo s]
+regexp { +([-0-9.+eE]+) +triangles} $tri_info full triNotAutoTrShape
+vfit
+vdump $aShapeNotAutoTr
+
+if {${triIncmesh1} == ${triAutoTrShape}} {
+  puts "ERROR : Test failed. Incorrect triangulation in case of enabled auto triangulation feature."
+}
+if {${triIncmesh2} != ${triNotAutoTrShape}} {
+  puts "ERROR : Test failed. Incorrect triangulation in case of disabled auto triangulation feature."
+}
diff --git a/tests/bugs/vis/bug23200_1 b/tests/bugs/vis/bug23200_1
new file mode 100644 (file)
index 0000000..1f2fc83
--- /dev/null
@@ -0,0 +1,23 @@
+puts "============"
+puts "CR23200"
+puts "Check that the shape doesn't have a shading presentation"
+puts "due to its triangulation isn't computed in case of disabled auto triangulation feature."
+puts "But in this case the shape should have special wireframe presentation."
+puts "============"
+puts ""
+
+vinit View1
+vclear
+vaxo
+vsetdispmode 1
+vdefaults -autoTriang off
+pcone c 0 5 10
+vdisplay c
+vfit
+
+set aColor [vreadpixel 200 77 rgb name]
+vdump $imagedir/${casename}_shape_pres.png
+
+if {"$aColor" != "GRAY75"} {
+  puts "Error: shading presentation of shape is incorrect"
+}
index 32b650a..5815f0c 100755 (executable)
@@ -12,7 +12,7 @@ vinit
 vdisplay s
 vfit
 
-vdefaults angDefl=1
+vdefaults -angDefl 1
 
 vsetdispmode s 1
 vdump ${imagedir}/${casename}_1.png
index 15ee4e1..8bc69e9 100755 (executable)
@@ -12,7 +12,7 @@ vinit
 vdisplay s
 vfit
 
-vdefaults angDefl=1
+vdefaults -angDefl 1
 
 vsetdispmode s 1
 vdump ${imagedir}/${casename}_1.png
index 0545000..8917585 100755 (executable)
@@ -12,7 +12,7 @@ vinit
 vdisplay s
 vfit
 
-vdefaults angDefl=1
+vdefaults -angDefl 1
 
 vsetdispmode s 1
 vdump ${imagedir}/${casename}_1.png
index f6df352..86422c1 100644 (file)
@@ -12,7 +12,11 @@ XGetOneShape res_1 D_First
 vinit
 vsetdispmode 1
 vdisplay res_1
+
 vfit
+vdump $::imagedir/${::casename}_fit.png
+
+vviewparams -eye 106.849 -177.049 169.775 -at -70.2 -5.456e-015 -7.274 -up -0.408 0.408 0.816 -scale 3.048
 
 set ver_color [vreadpixel 157 104]
 if {$ver_color == "0 0 0 0"} {
@@ -34,5 +38,6 @@ set ver_color [vreadpixel 243 323]
 if {$ver_color == "0 0 0 0"} {
   puts "ERROR: OCC23969 is reproduced"
 }
+vdump $::imagedir/${::casename}_center.png
 
 set 3dviewer 1
index edcba9c..2922b1a 100644 (file)
@@ -10,7 +10,7 @@ box b 2 0 0 1 0.5 0.25
 # draw box
 vinit View1
 vclear
-vdefaults absDefl=0.5
+vdefaults -absDefl 0.5
 vsetdispmode 1
 vaxo
 vdisplay f
index 11fe8a9..6d183ad 100644 (file)
@@ -9,7 +9,7 @@ tclean f
 # draw box
 vinit View1
 vclear
-vdefaults absDefl=0.5
+vdefaults -absDefl 0.5
 vsetdispmode 1
 vaxo
 vdisplay f
index f65abf9..0f465ef 100644 (file)
@@ -9,7 +9,7 @@ tclean f
 # draw box
 vinit View1
 vclear
-vdefaults absDefl=0.5
+vdefaults -absDefl 0.5
 vsetdispmode 1
 vaxo
 vdisplay f