]> OCCT Git - occt-copy.git/commitdiff
0025612: Introduce possibility to disable adaptive reconfigutation of triangles in...
authoroan <oan@opencascade.com>
Thu, 25 Dec 2014 15:17:56 +0000 (18:17 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 25 Dec 2014 15:19:02 +0000 (18:19 +0300)
Remarks from PDN: flag has been renamed to ControlSurfaceDeflection

Test-case for issue #25612

src/BRepMesh/BRepMesh_FastDiscret.cxx
src/BRepMesh/BRepMesh_FastDiscret.hxx
src/BRepMesh/BRepMesh_FastDiscretFace.cxx
src/BRepMesh/BRepMesh_FastDiscretFace.hxx
src/BRepMesh/BRepMesh_IncrementalMesh.cxx
src/BRepMesh/BRepMesh_IncrementalMesh.hxx
src/MeshTest/MeshTest.cxx
tests/bugs/mesh/bug25612 [new file with mode: 0644]

index 2ce0d395a474c11798445b2bc63695a69934f1fe..933a8b74c7281b3f15ac706ad657293a5af04cb3 100644 (file)
@@ -86,16 +86,17 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FastDiscret, Standard_Transient)
 //purpose  : 
 //=======================================================================
 BRepMesh_FastDiscret::BRepMesh_FastDiscret(
-  const Standard_Real                              theDefle,
-  const Standard_Real                              theAngl,
-  const Bnd_Box&                                   theBox,
-  const Standard_Boolean                           theWithShare,
-  const Standard_Boolean                           theInshape,
-  const Standard_Boolean                           theRelative,
-  const Standard_Boolean                           theShapetrigu,
-  const Standard_Boolean                           isInParallel,
-  const Standard_Real                              theMinSize,
-  const Standard_Boolean                           isInternalVerticesMode)
+  const Standard_Real    theDefle,
+  const Standard_Real    theAngl,
+  const Bnd_Box&         theBox,
+  const Standard_Boolean theWithShare,
+  const Standard_Boolean theInshape,
+  const Standard_Boolean theRelative,
+  const Standard_Boolean theShapetrigu,
+  const Standard_Boolean isInParallel,
+  const Standard_Real    theMinSize,
+  const Standard_Boolean isInternalVerticesMode,
+  const Standard_Boolean isControlSurfaceDeflection)
 : myAngle (theAngl),
   myDeflection (theDefle),
   myWithShare (theWithShare),
@@ -106,7 +107,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
   myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
   myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
   myMinSize(theMinSize),
-  myInternalVerticesMode(isInternalVerticesMode)
+  myInternalVerticesMode(isInternalVerticesMode),
+  myIsControlSurfaceDeflection(isControlSurfaceDeflection)
 {
   if ( myRelative )
     BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
@@ -127,7 +129,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
   const Standard_Boolean theShapetrigu,
   const Standard_Boolean isInParallel,
   const Standard_Real    theMinSize,
-  const Standard_Boolean isInternalVerticesMode)
+  const Standard_Boolean isInternalVerticesMode,
+  const Standard_Boolean isControlSurfaceDeflection)
 : myAngle (theAngl),
   myDeflection (theDefle),
   myWithShare (theWithShare),
@@ -138,7 +141,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
   myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
   myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
   myMinSize(theMinSize),
-  myInternalVerticesMode(isInternalVerticesMode)
+  myInternalVerticesMode(isInternalVerticesMode),
+  myIsControlSurfaceDeflection(isControlSurfaceDeflection)
 {
   if ( myRelative )
     BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
@@ -202,7 +206,8 @@ void BRepMesh_FastDiscret::Process(const TopoDS_Face& theFace) const
     {
       OCC_CATCH_SIGNALS
 
-      BRepMesh_FastDiscretFace aTool(GetAngle(), myMinSize, myInternalVerticesMode);
+      BRepMesh_FastDiscretFace aTool(GetAngle(), myMinSize, 
+        myInternalVerticesMode, myIsControlSurfaceDeflection);
       aTool.Perform(anAttribute);
     }
     catch (Standard_Failure)
index 37599a19e088351d65b6808ba64d7f6cdfd24073..c515032aa095647f5dd4d39c44fc0a9ca8710b2b 100644 (file)
@@ -58,16 +58,18 @@ class BRepMesh_FastDiscret : public Standard_Transient
 {
 public:
   
-  Standard_EXPORT BRepMesh_FastDiscret(const Standard_Real defle,
-                                       const Standard_Real angle,
-                                       const Bnd_Box& B,
-                                       const Standard_Boolean withShare = Standard_True,
-                                       const Standard_Boolean inshape = Standard_False,
-                                       const Standard_Boolean relative = Standard_False,
-                                       const Standard_Boolean shapetrigu = Standard_False,
-                                       const Standard_Boolean isInParallel = Standard_False,
-                                       const Standard_Real    theMinSize   = Precision::Confusion(),
-                                       const Standard_Boolean isInternalVerticesMode = Standard_True);
+  Standard_EXPORT BRepMesh_FastDiscret(
+    const Standard_Real defle,
+    const Standard_Real angle,
+    const Bnd_Box& B,
+    const Standard_Boolean withShare = Standard_True,
+    const Standard_Boolean inshape = Standard_False,
+    const Standard_Boolean relative = Standard_False,
+    const Standard_Boolean shapetrigu = Standard_False,
+    const Standard_Boolean isInParallel = Standard_False,
+    const Standard_Real    theMinSize   = Precision::Confusion(),
+    const Standard_Boolean isInternalVerticesMode = Standard_True,
+    const Standard_Boolean isControlSurfaceDeflection = Standard_True);
 
   //! if the boolean <relative> is True, the <br>
   //! deflection used for the polygonalisation of <br>
@@ -81,17 +83,19 @@ public:
   //! <br>
   //! if <inshape> is True, the calculated <br>
   //! triangulation will be stored in the shape. <br>
-  Standard_EXPORT BRepMesh_FastDiscret(const TopoDS_Shape& shape,
-                                       const Standard_Real defle,
-                                       const Standard_Real angle,
-                                       const Bnd_Box& B,
-                                       const Standard_Boolean withShare = Standard_True,
-                                       const Standard_Boolean inshape = Standard_False,
-                                       const Standard_Boolean relative = Standard_False,
-                                       const Standard_Boolean shapetrigu = Standard_False,
-                                       const Standard_Boolean isInParallel = Standard_False,
-                                       const Standard_Real    theMinSize   = Precision::Confusion(),
-                                       const Standard_Boolean isInternalVerticesMode = Standard_True);
+  Standard_EXPORT BRepMesh_FastDiscret(
+    const TopoDS_Shape& shape,
+    const Standard_Real defle,
+    const Standard_Real angle,
+    const Bnd_Box& B,
+    const Standard_Boolean withShare = Standard_True,
+    const Standard_Boolean inshape = Standard_False,
+    const Standard_Boolean relative = Standard_False,
+    const Standard_Boolean shapetrigu = Standard_False,
+    const Standard_Boolean isInParallel = Standard_False,
+    const Standard_Real    theMinSize   = Precision::Confusion(),
+    const Standard_Boolean isInternalVerticesMode = Standard_True,
+    const Standard_Boolean isControlSurfaceDeflection = Standard_True);
 
   //! Build triangulation on the whole shape.
   Standard_EXPORT void Perform(const TopoDS_Shape& shape);
@@ -369,6 +373,7 @@ private:
 
   Standard_Real                                    myMinSize;
   Standard_Boolean                                 myInternalVerticesMode;
+  Standard_Boolean                                 myIsControlSurfaceDeflection;
 };
 
 DEFINE_STANDARD_HANDLE(BRepMesh_FastDiscret, Standard_Transient)
index d39b2fb552772eb3c73b5a7cc312f744689756b5..cdba30c9d0d93e2eefe9c1dca719ebf99eec2c8e 100644 (file)
@@ -145,10 +145,12 @@ namespace
 BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace(
   const Standard_Real    theAngle,
   const Standard_Real    theMinSize,
-  const Standard_Boolean isInternalVerticesMode)
+  const Standard_Boolean isInternalVerticesMode,
+  const Standard_Boolean isControlSurfaceDeflection)
 : myAngle(theAngle),
   myInternalVerticesMode(isInternalVerticesMode),
-  myMinSize(theMinSize)
+  myMinSize(theMinSize),
+  myIsControlSurfaceDeflection(isControlSurfaceDeflection)
 {
 }
 
@@ -387,7 +389,8 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
       insertInternalVertices(aNewVertices, trigu);
 
       //control internal points
-      aDef = control(aNewVertices, trigu, Standard_False);
+      if (myIsControlSurfaceDeflection)
+        aDef = control(aNewVertices, trigu, Standard_False);
     }
   }
 
index 9eac84e60690aa0004a783f084bdb014659c042a..66e05b1c73618b21c16ab1b5d4db8148f5dac90b 100644 (file)
@@ -54,10 +54,13 @@ public:
   //! @param theAngle deviation angle to be used for surface tessellation.
   //! @param isInternalVerticesMode flag enabling/disabling internal 
   //! vertices mode.
+  //! @param isControlSurfaceDeflection enables/disables adaptive 
+  //! reconfiguration of mesh.
   Standard_EXPORT BRepMesh_FastDiscretFace(
     const Standard_Real    theAngle,
     const Standard_Real    theMinSize,
-    const Standard_Boolean isInternalVerticesMode);
+    const Standard_Boolean isInternalVerticesMode,
+    const Standard_Boolean isControlSurfaceDeflection);
 
   Standard_EXPORT void Perform(const Handle(BRepMesh_FaceAttribute)& theAttribute);
 
@@ -191,6 +194,7 @@ private:
   Handle(BRepMesh_DataStructureOfDelaun) myStructure;
 
   Standard_Real                          myMinSize;
+  Standard_Boolean                       myIsControlSurfaceDeflection;
 };
 
 DEFINE_STANDARD_HANDLE (BRepMesh_FastDiscretFace, Standard_Transient)
index 6a808e21c7c7cfcf00f82e983399a28c39ad29a4..c7fefa84f6d428e5b0ab1fa910c147c04596debc 100644 (file)
@@ -75,7 +75,8 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
 : myRelative  (Standard_False),
   myInParallel(Standard_False),
   myMinSize   (Precision::Confusion()),
-  myInternalVerticesMode(Standard_True)
+  myInternalVerticesMode(Standard_True),
+  myIsControlSurfaceDeflection(Standard_True)
 {
 }
 
@@ -92,7 +93,8 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(
   : myRelative  (isRelative),
     myInParallel(isInParallel),
     myMinSize   (Precision::Confusion()),
-    myInternalVerticesMode(Standard_True)
+    myInternalVerticesMode(Standard_True),
+    myIsControlSurfaceDeflection(Standard_True)
 {
   myDeflection  = theLinDeflection;
   myAngle       = theAngDeflection;
@@ -149,7 +151,7 @@ void BRepMesh_IncrementalMesh::init()
   myMesh = new BRepMesh_FastDiscret(myDeflection, 
     myAngle, aBox, Standard_True, Standard_True, 
     myRelative, Standard_True, myInParallel, myMinSize,
-    myInternalVerticesMode);
+    myInternalVerticesMode, myIsControlSurfaceDeflection);
 
   myMesh->InitSharedFaces(myShape);
 }
index d18588bd326a7bad986601a406a43764e108b127..1169a0c37859f651651cdcef1e32cb8ea5774c10 100644 (file)
@@ -115,7 +115,7 @@ public: //! @name accessing to parameters.
     return myMinSize;
   }
 
-  //! Enables/disables internal vertices mode.
+  //! Enables/disables internal vertices mode (enabled by default).
   inline void SetInternalVerticesMode(const Standard_Boolean isEnabled)
   {
     myInternalVerticesMode = isEnabled;
@@ -127,6 +127,20 @@ public: //! @name accessing to parameters.
     return myInternalVerticesMode;
   }
 
+  //! Enables/disables control of deflection of mesh from real surface 
+  //! (enabled by default).
+  inline void SetControlSurfaceDeflection(const Standard_Boolean isEnabled)
+  {
+    myIsControlSurfaceDeflection = isEnabled;
+  }
+
+  //! Returns flag indicating is adaptive reconfiguration 
+  //! of mesh enabled/disabled.
+  inline Standard_Boolean IsControlSurfaceDeflection() const
+  {
+    return myIsControlSurfaceDeflection;
+  }
+
 public: //! @name plugin API
 
   //! Plugin interface for the Mesh Factories.
@@ -219,6 +233,7 @@ protected:
   NCollection_Vector<TopoDS_Face>             myFaces;
   Standard_Real                               myMinSize;
   Standard_Boolean                            myInternalVerticesMode;
+  Standard_Boolean                            myIsControlSurfaceDeflection;
 };
 
 DEFINE_STANDARD_HANDLE(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
index 372049d3b9e3d202d2350adc2f561aad648ec879..cb030ebc651c76ca7909c18d2a712af5083930ba 100644 (file)
@@ -136,6 +136,8 @@ options:\n\
                         (switched off by default)\n\n\
         -int_vert_off   disables insertion of internal vertices into mesh\n\
                         (enabled by default)\n\
+        -surf_def_off   disables control of deflection of mesh from real\n\
+                        surface (enabled by default)\n\
         -parallel       enables parallel execution (switched off by default)\n";
     return 0;
   }
@@ -147,12 +149,13 @@ options:\n\
     return 0;
   }
 
-  Standard_Real aLinDeflection   = Max(Draw::Atof(argv[2]), Precision::Confusion());
-  Standard_Real aAngDeflection   = 0.5;
-  Standard_Real aMinSize         = Precision::Confusion();
-  Standard_Boolean isRelative    = Standard_False;
-  Standard_Boolean isInParallel  = Standard_False;
-  Standard_Boolean isIntVertices = Standard_True;
+  Standard_Real aLinDeflection     = Max(Draw::Atof(argv[2]), Precision::Confusion());
+  Standard_Real aAngDeflection     = 0.5;
+  Standard_Real aMinSize           = Precision::Confusion();
+  Standard_Boolean isRelative      = Standard_False;
+  Standard_Boolean isInParallel    = Standard_False;
+  Standard_Boolean isIntVertices   = Standard_True;
+  Standard_Boolean isControlSurDef = Standard_True;
 
   if (nbarg > 3)
   {
@@ -170,6 +173,8 @@ options:\n\
         isInParallel = Standard_True;
       else if (aOpt == "-int_vert_off")
         isIntVertices = Standard_False;
+      else if (aOpt == "-surf_def_off")
+        isControlSurDef = Standard_False;
       else if (i < nbarg)
       {
         Standard_Real aVal = Draw::Atof(argv[i++]);
@@ -194,6 +199,7 @@ options:\n\
   aMesher.SetParallel  (isInParallel);
   aMesher.SetMinSize   (aMinSize);
   aMesher.SetInternalVerticesMode(isIntVertices);
+  aMesher.SetControlSurfaceDeflection(isControlSurDef);
   aMesher.Perform();
 
   di << "Meshing statuses: ";
diff --git a/tests/bugs/mesh/bug25612 b/tests/bugs/mesh/bug25612
new file mode 100644 (file)
index 0000000..3cee3d0
--- /dev/null
@@ -0,0 +1,29 @@
+puts "========"
+puts "OCC25612"
+puts "========"
+puts ""
+######################################################################################
+# Introduce possibility to disable adaptive reconfigutation of triangles in BRepMesh
+######################################################################################
+
+restore [locate_data_file bug25519_testtriangulation.brep] a
+
+tclean a
+incmesh a 0.001
+set bug_info [trinfo a]
+set TNumber_1 [lindex $bug_info 3]
+set NNumber_1 [lindex $bug_info 5]
+
+tclean a
+incmesh a 0.001 -surf_def_off
+set bug_info [trinfo a]
+set TNumber_2 [lindex $bug_info 3]
+set NNumber_2 [lindex $bug_info 5]
+
+if {$TNumber_2 >= $TNumber_1} {
+   puts "ERROR: OCC25612 is reproduced. Flag -surf_def_off does not work (triangles)."
+}
+
+if {$NNumber_2 >= $NNumber_1} {
+   puts "ERROR: OCC25612 is reproduced. Flag -surf_def_off does not work (nodes)."
+}