]> OCCT Git - occt.git/commitdiff
Porting of BRepMesh 7.5.0
authoroan <oan@opencascade.com>
Mon, 16 Jan 2023 11:58:07 +0000 (14:58 +0300)
committeroan <oan@opencascade.com>
Mon, 16 Jan 2023 11:58:07 +0000 (14:58 +0300)
142 files changed:
src/BRepMesh/BRepMesh_BaseMeshAlgo.cxx
src/BRepMesh/BRepMesh_BaseMeshAlgo.hxx
src/BRepMesh/BRepMesh_Circle.hxx
src/BRepMesh/BRepMesh_CircleInspector.hxx
src/BRepMesh/BRepMesh_CircleTool.hxx
src/BRepMesh/BRepMesh_Classifier.cxx
src/BRepMesh/BRepMesh_Classifier.hxx
src/BRepMesh/BRepMesh_ConstrainedBaseMeshAlgo.cxx [new file with mode: 0644]
src/BRepMesh/BRepMesh_ConstrainedBaseMeshAlgo.hxx
src/BRepMesh/BRepMesh_Context.cxx
src/BRepMesh/BRepMesh_Context.hxx
src/BRepMesh/BRepMesh_CurveTessellator.cxx
src/BRepMesh/BRepMesh_CurveTessellator.hxx
src/BRepMesh/BRepMesh_CustomBaseMeshAlgo.cxx [new file with mode: 0644]
src/BRepMesh/BRepMesh_CustomBaseMeshAlgo.hxx
src/BRepMesh/BRepMesh_CustomDelaunayBaseMeshAlgo.hxx
src/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx
src/BRepMesh/BRepMesh_DataStructureOfDelaun.hxx
src/BRepMesh/BRepMesh_DefaultRangeSplitter.cxx
src/BRepMesh/BRepMesh_DefaultRangeSplitter.hxx
src/BRepMesh/BRepMesh_Deflection.cxx
src/BRepMesh/BRepMesh_Deflection.hxx
src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx [new file with mode: 0644]
src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.hxx [new file with mode: 0644]
src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.cxx [new file with mode: 0644]
src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.hxx [new file with mode: 0644]
src/BRepMesh/BRepMesh_Delaun.cxx
src/BRepMesh/BRepMesh_Delaun.hxx
src/BRepMesh/BRepMesh_DelaunayBaseMeshAlgo.cxx
src/BRepMesh/BRepMesh_DelaunayBaseMeshAlgo.hxx
src/BRepMesh/BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx
src/BRepMesh/BRepMesh_DelaunayNodeInsertionMeshAlgo.hxx
src/BRepMesh/BRepMesh_DiscretFactory.hxx
src/BRepMesh/BRepMesh_DiscretRoot.hxx
src/BRepMesh/BRepMesh_Edge.hxx
src/BRepMesh/BRepMesh_EdgeDiscret.cxx
src/BRepMesh/BRepMesh_EdgeDiscret.hxx
src/BRepMesh/BRepMesh_EdgeParameterProvider.hxx
src/BRepMesh/BRepMesh_EdgeTessellationExtractor.cxx
src/BRepMesh/BRepMesh_EdgeTessellationExtractor.hxx
src/BRepMesh/BRepMesh_FaceChecker.cxx
src/BRepMesh/BRepMesh_FaceChecker.hxx
src/BRepMesh/BRepMesh_FaceDiscret.cxx
src/BRepMesh/BRepMesh_FaceDiscret.hxx
src/BRepMesh/BRepMesh_GeomTool.hxx
src/BRepMesh/BRepMesh_IncrementalMesh.cxx
src/BRepMesh/BRepMesh_IncrementalMesh.hxx
src/BRepMesh/BRepMesh_MeshAlgoFactory.cxx
src/BRepMesh/BRepMesh_MeshAlgoFactory.hxx
src/BRepMesh/BRepMesh_MeshTool.cxx
src/BRepMesh/BRepMesh_MeshTool.hxx
src/BRepMesh/BRepMesh_ModelBuilder.cxx
src/BRepMesh/BRepMesh_ModelBuilder.hxx
src/BRepMesh/BRepMesh_ModelHealer.cxx
src/BRepMesh/BRepMesh_ModelHealer.hxx
src/BRepMesh/BRepMesh_ModelPostProcessor.cxx
src/BRepMesh/BRepMesh_ModelPostProcessor.hxx
src/BRepMesh/BRepMesh_ModelPreProcessor.cxx
src/BRepMesh/BRepMesh_ModelPreProcessor.hxx
src/BRepMesh/BRepMesh_NURBSRangeSplitter.cxx
src/BRepMesh/BRepMesh_NURBSRangeSplitter.hxx
src/BRepMesh/BRepMesh_OrientedEdge.hxx
src/BRepMesh/BRepMesh_PairOfIndex.hxx
src/BRepMesh/BRepMesh_SelectorOfDataStructureOfDelaun.cxx
src/BRepMesh/BRepMesh_SelectorOfDataStructureOfDelaun.hxx
src/BRepMesh/BRepMesh_ShapeTool.cxx
src/BRepMesh/BRepMesh_ShapeTool.hxx
src/BRepMesh/BRepMesh_ShapeVisitor.cxx
src/BRepMesh/BRepMesh_ShapeVisitor.hxx
src/BRepMesh/BRepMesh_SphereRangeSplitter.hxx
src/BRepMesh/BRepMesh_Triangle.hxx
src/BRepMesh/BRepMesh_UVParamRangeSplitter.hxx
src/BRepMesh/BRepMesh_Vertex.hxx
src/BRepMesh/BRepMesh_VertexInspector.hxx
src/BRepMesh/BRepMesh_VertexTool.cxx
src/BRepMesh/BRepMesh_VertexTool.hxx
src/BRepMesh/FILES
src/BRepMesh/delabella.cpp [new file with mode: 0644]
src/BRepMesh/delabella.pxx [new file with mode: 0644]
src/BRepMeshData/BRepMeshData_Curve.cxx
src/BRepMeshData/BRepMeshData_Curve.hxx
src/BRepMeshData/BRepMeshData_Edge.cxx
src/BRepMeshData/BRepMeshData_Edge.hxx
src/BRepMeshData/BRepMeshData_Face.cxx
src/BRepMeshData/BRepMeshData_Face.hxx
src/BRepMeshData/BRepMeshData_Model.cxx
src/BRepMeshData/BRepMeshData_Model.hxx
src/BRepMeshData/BRepMeshData_PCurve.cxx
src/BRepMeshData/BRepMeshData_PCurve.hxx
src/BRepMeshData/BRepMeshData_Wire.cxx
src/BRepMeshData/BRepMeshData_Wire.hxx
src/IMeshData/FILES
src/IMeshData/IMeshData_Curve.cxx [new file with mode: 0644]
src/IMeshData/IMeshData_Curve.hxx
src/IMeshData/IMeshData_Edge.cxx [new file with mode: 0644]
src/IMeshData/IMeshData_Edge.hxx
src/IMeshData/IMeshData_Face.cxx [new file with mode: 0644]
src/IMeshData/IMeshData_Face.hxx
src/IMeshData/IMeshData_Model.cxx [new file with mode: 0644]
src/IMeshData/IMeshData_Model.hxx
src/IMeshData/IMeshData_PCurve.cxx [new file with mode: 0644]
src/IMeshData/IMeshData_PCurve.hxx
src/IMeshData/IMeshData_ParametersList.cxx [new file with mode: 0644]
src/IMeshData/IMeshData_ParametersList.hxx
src/IMeshData/IMeshData_ParametersListArrayAdaptor.hxx
src/IMeshData/IMeshData_Shape.cxx [new file with mode: 0644]
src/IMeshData/IMeshData_Shape.hxx
src/IMeshData/IMeshData_Status.hxx
src/IMeshData/IMeshData_StatusOwner.hxx
src/IMeshData/IMeshData_TessellatedShape.cxx [new file with mode: 0644]
src/IMeshData/IMeshData_TessellatedShape.hxx
src/IMeshData/IMeshData_Wire.cxx [new file with mode: 0644]
src/IMeshData/IMeshData_Wire.hxx
src/IMeshTools/FILES
src/IMeshTools/IMeshTools_Context.cxx [new file with mode: 0644]
src/IMeshTools/IMeshTools_Context.hxx
src/IMeshTools/IMeshTools_CurveTessellator.cxx [new file with mode: 0644]
src/IMeshTools/IMeshTools_CurveTessellator.hxx
src/IMeshTools/IMeshTools_MeshAlgo.cxx [new file with mode: 0644]
src/IMeshTools/IMeshTools_MeshAlgo.hxx
src/IMeshTools/IMeshTools_MeshAlgoFactory.cxx [new file with mode: 0644]
src/IMeshTools/IMeshTools_MeshAlgoFactory.hxx
src/IMeshTools/IMeshTools_MeshAlgoType.hxx [new file with mode: 0644]
src/IMeshTools/IMeshTools_MeshBuilder.cxx
src/IMeshTools/IMeshTools_MeshBuilder.hxx
src/IMeshTools/IMeshTools_ModelAlgo.cxx [new file with mode: 0644]
src/IMeshTools/IMeshTools_ModelAlgo.hxx
src/IMeshTools/IMeshTools_ModelBuilder.cxx [new file with mode: 0644]
src/IMeshTools/IMeshTools_ModelBuilder.hxx
src/IMeshTools/IMeshTools_Parameters.hxx
src/IMeshTools/IMeshTools_ShapeExplorer.cxx
src/IMeshTools/IMeshTools_ShapeExplorer.hxx
src/IMeshTools/IMeshTools_ShapeVisitor.cxx [new file with mode: 0644]
src/IMeshTools/IMeshTools_ShapeVisitor.hxx
src/MeshTest/FILES
src/MeshTest/MeshTest.cxx
src/MeshTest/MeshTest_CheckTopology.cxx
src/MeshTest/MeshTest_CheckTopology.hxx
src/MeshTest/MeshTest_Debug.cxx
src/MeshTest/MeshTest_DrawableMesh.cxx [deleted file]
src/MeshTest/MeshTest_DrawableMesh.hxx [deleted file]
src/MeshTest/MeshTest_PluginCommands.cxx

index dce927a2c4b6df2a2c11b6f7a9730e0ba310260e..4f4c7d1516a10f768448d1edb76ed21048cd8202 100644 (file)
@@ -24,6 +24,8 @@
 #include <BRepMesh_ShapeTool.hxx>
 #include <Standard_ErrorHandler.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_BaseMeshAlgo, IMeshTools_MeshAlgo)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index 56c03b2e8ac506560fc6cf62ebc9544877bcfd52..72e9ff2320f44cd07f0a591e400fe93fa5d49014 100644 (file)
@@ -25,7 +25,7 @@
 class BRepMesh_DataStructureOfDelaun;
 class BRepMesh_Delaun;
 
-//! Class provides base fuctionality for algorithms building face triangulation.
+//! Class provides base functionality for algorithms building face triangulation.
 //! Performs initialization of BRepMesh_DataStructureOfDelaun and nodes map structures.
 class BRepMesh_BaseMeshAlgo : public IMeshTools_MeshAlgo
 {
@@ -44,36 +44,36 @@ public:
     const IMeshData::IFaceHandle& theDFace,
     const IMeshTools_Parameters&  theParameters) Standard_OVERRIDE;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_BaseMeshAlgo, IMeshTools_MeshAlgo)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_BaseMeshAlgo, IMeshTools_MeshAlgo)
 
 protected:
 
   //! Gets discrete face.
-  inline const IMeshData::IFaceHandle& getDFace() const
+  const IMeshData::IFaceHandle& getDFace() const
   {
     return myDFace;
   }
 
   //! Gets meshing parameters.
-  inline const IMeshTools_Parameters& getParameters() const
+  const IMeshTools_Parameters& getParameters() const
   {
     return myParameters;
   }
 
   //! Gets common allocator.
-  inline const Handle(NCollection_IncAllocator)& getAllocator() const
+  const Handle(NCollection_IncAllocator)& getAllocator() const
   {
     return myAllocator;
   }
 
   //! Gets mesh structure.
-  inline const Handle(BRepMesh_DataStructureOfDelaun)& getStructure() const
+  const Handle(BRepMesh_DataStructureOfDelaun)& getStructure() const
   {
     return myStructure;
   }
 
   //! Gets 3d nodes map.
-  inline const Handle(VectorOfPnt)& getNodesMap() const
+  const Handle(VectorOfPnt)& getNodesMap() const
   {
     return myNodesMap;
   }
@@ -107,7 +107,7 @@ protected:
 
 private:
 
-  //! If the given edge has another pcurve for current face coinsiding with specified one,
+  //! If the given edge has another pcurve for current face coinciding with specified one,
   //! returns TopAbs_INTERNAL flag. Elsewhere returns orientation of specified pcurve.
   TopAbs_Orientation fixSeamEdgeOrientation(
     const IMeshData::IEdgeHandle&   theDEdge,
index 15d748f1ca70258e24b69f462e7819d3072a93bc..c37813fc19f23a5a83d417b4fd6d81425cdc4ca5 100644 (file)
@@ -44,26 +44,26 @@ public:
   
   //! Sets location of a circle.
   //! @param theLocation location of a circle.
-  inline void SetLocation(const gp_XY& theLocation)
+  void SetLocation(const gp_XY& theLocation)
   {
     myLocation = theLocation;
   }
   
   //! Sets radius of a circle.
   //! @param theRadius radius of a circle.
-  inline void SetRadius(const Standard_Real theRadius)
+  void SetRadius(const Standard_Real theRadius)
   {
     myRadius = theRadius;
   }
   
   //! Returns location of a circle.
-  inline const gp_XY& Location() const
+  const gp_XY& Location() const
   {
     return myLocation;
   }
 
   //! Returns radius of a circle.
-  inline const Standard_Real& Radius() const
+  const Standard_Real& Radius() const
   {
     return myRadius;
   }
index c954d7d50ce8415795482cd256859abca21d2a23..8bdac2c65a0098304b7f4d4568161e2f5f83d7ba 100644 (file)
@@ -46,14 +46,14 @@ public:
   //! Adds the circle to vector of circles at the given position.
   //! @param theIndex position of circle in the vector.
   //! @param theCircle circle to be added.
-  inline void Bind(const Standard_Integer theIndex,
-                   const BRepMesh_Circle& theCircle)
+  void Bind(const Standard_Integer theIndex,
+            const BRepMesh_Circle& theCircle)
   {
     myCircles.SetValue(theIndex, theCircle);
   }
 
   //! Resutns vector of registered circles.
-  inline const IMeshData::VectorOfCircle& Circles() const
+  const IMeshData::VectorOfCircle& Circles() const
   {
     return myCircles; 
   }
@@ -61,21 +61,21 @@ public:
   //! Returns circle with the given index.
   //! @param theIndex index of circle.
   //! @return circle with the given index.
-  inline BRepMesh_Circle& Circle(const Standard_Integer theIndex)
+  BRepMesh_Circle& Circle(const Standard_Integer theIndex)
   {
     return myCircles(theIndex);
   }
 
   //! Set reference point to be checked.
   //! @param thePoint bullet point.
-  inline void SetPoint(const gp_XY& thePoint)
+  void SetPoint(const gp_XY& thePoint)
   {
     myResIndices.Clear();
     myPoint = thePoint;
   }
 
   //! Returns list of circles shot by the reference point.
-  inline IMeshData::ListOfInteger& GetShotCircles()
+  IMeshData::ListOfInteger& GetShotCircles()
   {
     return myResIndices;
   }
@@ -83,7 +83,7 @@ public:
   //! Performs inspection of a circle with the given index.
   //! @param theTargetIndex index of a circle to be checked.
   //! @return status of the check.
-  inline NCollection_CellFilter_Action Inspect(
+  NCollection_CellFilter_Action Inspect(
     const Standard_Integer theTargetIndex)
   {
     BRepMesh_Circle& aCircle = myCircles(theTargetIndex);
index 3f5701d63dfb423dfbadaeac7d03a6243966c48e..7dd550180987da7c204378591ebf8a74bdbae9f0 100644 (file)
@@ -50,14 +50,14 @@ public:
 
   //! Initializes the tool.
   //! @param theReservedSize size to be reserved for vector of circles.
-  inline void Init(const Standard_Integer /*theReservedSize*/)
+  void Init(const Standard_Integer /*theReservedSize*/)
   {
     myTolerance = Precision::PConfusion();
   }
 
   //! Sets new size for cell filter.
   //! @param theSize cell size to be set for X and Y dimensions.
-  inline void SetCellSize(const Standard_Real theSize)
+  void SetCellSize(const Standard_Real theSize)
   {
     myCellFilter.Reset(theSize, myAllocator);
   }
@@ -65,8 +65,8 @@ public:
   //! Sets new size for cell filter.
   //! @param theSizeX cell size to be set for X dimension.
   //! @param theSizeY cell size to be set for Y dimension.
-  inline void SetCellSize(const Standard_Real theSizeX,
-                          const Standard_Real theSizeY)
+  void SetCellSize(const Standard_Real theSizeX,
+                   const Standard_Real theSizeY)
   {
     Standard_Real aCellSizeC[2] = { theSizeX, theSizeY };
     NCollection_Array1<Standard_Real> aCellSize(aCellSizeC[0], 1, 2);
@@ -76,15 +76,15 @@ public:
   //! Sets limits of inspection area.
   //! @param theMin bottom left corner of inspection area.
   //! @param theMax top right corner of inspection area.
-  inline void SetMinMaxSize(const gp_XY& theMin,
-                            const gp_XY& theMax)
+  void SetMinMaxSize(const gp_XY& theMin,
+                     const gp_XY& theMax)
   {
     myFaceMin = theMin;
     myFaceMax = theMax;
   }
 
   //! Retruns true if cell filter contains no circle.
-  inline Standard_Boolean IsEmpty () const
+  Standard_Boolean IsEmpty () const
   {
     return mySelector.Circles ().IsEmpty ();
   }
index 9ec0ca51dd5122e7c52d0c73382d4ff1c044ae02..30f853cb84ef9dc41715de3b8cf56633a0886b03 100644 (file)
@@ -20,6 +20,8 @@
 #include <CSLib_Class2d.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_Classifier, Standard_Transient)
+
 //=======================================================================
 //function : Constructor
 //purpose  : 
index d7ee6f57e5ce1b497cae6963ef479fccefacdf08..c81a303eaa0f3bf993e276997c510cc370e96cf1 100644 (file)
@@ -58,7 +58,7 @@ public:
     const std::pair<Standard_Real, Standard_Real>& theRangeU,
     const std::pair<Standard_Real, Standard_Real>& theRangeV);
 
-  DEFINE_STANDARD_RTTI_INLINE (BRepMesh_Classifier, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_Classifier, Standard_Transient)
 
 private:
 
diff --git a/src/BRepMesh/BRepMesh_ConstrainedBaseMeshAlgo.cxx b/src/BRepMesh/BRepMesh_ConstrainedBaseMeshAlgo.cxx
new file mode 100644 (file)
index 0000000..2c7201e
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BRepMesh_ConstrainedBaseMeshAlgo.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
\ No newline at end of file
index 7edd4aac23a2db872180f144a3502bba01bcd219..3b15fd673b705854d897f0786ef9761d237b67c8 100644 (file)
@@ -23,7 +23,7 @@
 class BRepMesh_DataStructureOfDelaun;
 class BRepMesh_Delaun;
 
-//! Class provides base fuctionality to build face triangulation using Dealunay approach.
+//! Class provides base functionality to build face triangulation using Dealunay approach.
 //! Performs generation of mesh using raw data from model.
 class BRepMesh_ConstrainedBaseMeshAlgo : public BRepMesh_BaseMeshAlgo
 {
@@ -39,7 +39,7 @@ public:
   {
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
 
 protected:
 
@@ -49,7 +49,7 @@ protected:
     return std::pair<Standard_Integer, Standard_Integer> (-1, -1);
   }
 
-  //! Perfroms processing of generated mesh.
+  //! Performs processing of generated mesh.
   //! By default does nothing.
   //! Expected to be called from method generateMesh() in successor classes.
   virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/)
index e48d038467c3efea18e13a1fc2bd8f387f505dec..5ff2294d38e600f9204d379572bc11c314f5a54e 100644 (file)
 #include <BRepMesh_FaceDiscret.hxx>
 #include <BRepMesh_ModelPreProcessor.hxx>
 #include <BRepMesh_ModelPostProcessor.hxx>
+
 #include <BRepMesh_MeshAlgoFactory.hxx>
+#include <BRepMesh_DelabellaMeshAlgoFactory.hxx>
+#include <Message.hxx>
+#include <OSD_Environment.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_Context, IMeshTools_Context)
 
 //=======================================================================
 // Function: Constructor
 // Purpose : 
 //=======================================================================
-BRepMesh_Context::BRepMesh_Context ()
+BRepMesh_Context::BRepMesh_Context (IMeshTools_MeshAlgoType theMeshType)
 {
+  if (theMeshType == IMeshTools_MeshAlgoType_DEFAULT)
+  {
+    TCollection_AsciiString aValue = OSD_Environment ("CSF_MeshAlgo").Value();
+    aValue.LowerCase();
+    if (aValue == "watson"
+     || aValue == "0")
+    {
+      theMeshType = IMeshTools_MeshAlgoType_Watson;
+    }
+    else if (aValue == "delabella"
+          || aValue == "1")
+    {
+      theMeshType = IMeshTools_MeshAlgoType_Delabella;
+    }
+    else
+    {
+      if (!aValue.IsEmpty())
+      {
+        Message::SendWarning (TCollection_AsciiString("BRepMesh_Context, ignore unknown algorithm '") + aValue + "' specified in CSF_MeshAlgo variable");
+      }
+      theMeshType = IMeshTools_MeshAlgoType_Watson;
+    }
+  }
+
+  Handle (IMeshTools_MeshAlgoFactory) aAlgoFactory;
+  switch (theMeshType)
+  {
+    case IMeshTools_MeshAlgoType_DEFAULT:
+    case IMeshTools_MeshAlgoType_Watson:
+      aAlgoFactory = new BRepMesh_MeshAlgoFactory();
+      break;
+    case IMeshTools_MeshAlgoType_Delabella:
+      aAlgoFactory = new BRepMesh_DelabellaMeshAlgoFactory();
+      break;
+  }
+
   SetModelBuilder (new BRepMesh_ModelBuilder);
   SetEdgeDiscret  (new BRepMesh_EdgeDiscret);
   SetModelHealer  (new BRepMesh_ModelHealer);
   SetPreProcessor (new BRepMesh_ModelPreProcessor);
-  SetFaceDiscret  (new BRepMesh_FaceDiscret(new BRepMesh_MeshAlgoFactory));
+  SetFaceDiscret  (new BRepMesh_FaceDiscret (aAlgoFactory));
   SetPostProcessor(new BRepMesh_ModelPostProcessor);
 }
 
index a802a6b44bf05184561e903f8f801f9cabd277f3..b99e6dce8a4c9e949068b16c113103480d7b772b 100644 (file)
@@ -25,12 +25,12 @@ class BRepMesh_Context : public IMeshTools_Context
 public:
 
   //! Constructor.
-  Standard_EXPORT BRepMesh_Context ();
+  Standard_EXPORT BRepMesh_Context (IMeshTools_MeshAlgoType theMeshType = IMeshTools_MeshAlgoType_DEFAULT);
 
   //! Destructor.
   Standard_EXPORT virtual ~BRepMesh_Context ();
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_Context, IMeshTools_Context)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_Context, IMeshTools_Context)
 };
 
 #endif
\ No newline at end of file
index bb780d27e0f0f0235d5e5e33d068e137d3c51ffc..179597bbc8e200d26ced2a246a797f51151ab68b 100644 (file)
@@ -28,6 +28,8 @@
 #include <Standard_Failure.hxx>
 #include <GCPnts_AbscissaPoint.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_CurveTessellator, IMeshTools_CurveTessellator)
+
 //=======================================================================
 //function : Constructor
 //purpose  : 
index 4a666be6b84937b6403c4be83733e3f9e86a3a60..eaf7f3784707aad6f2f53aebf70a9a6b87b1c941 100644 (file)
@@ -60,7 +60,7 @@ public:
     gp_Pnt&                thePoint,
     Standard_Real&         theParameter) const Standard_OVERRIDE;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_CurveTessellator, IMeshTools_CurveTessellator)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_CurveTessellator, IMeshTools_CurveTessellator)
 
 private:
 
diff --git a/src/BRepMesh/BRepMesh_CustomBaseMeshAlgo.cxx b/src/BRepMesh/BRepMesh_CustomBaseMeshAlgo.cxx
new file mode 100644 (file)
index 0000000..2f4a061
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BRepMesh_CustomBaseMeshAlgo.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
\ No newline at end of file
index e175091de90818829d2886a37ee01196e9942edb..0db7924caf33bf3e60f200655994a10450b779f8 100644 (file)
 
 class BRepMesh_DataStructureOfDelaun;
 
-//! Class provides base fuctionality to build face triangulation using custom triangulation algorithm.
+//! Class provides base functionality to build face triangulation using custom triangulation algorithm.
 //! Performs generation of mesh using raw data from model.
 class BRepMesh_CustomBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
 {
 public:
 
   //! Constructor.
-  Standard_EXPORT BRepMesh_CustomBaseMeshAlgo ()
+  BRepMesh_CustomBaseMeshAlgo ()
   {
   }
 
   //! Destructor.
-  Standard_EXPORT virtual ~BRepMesh_CustomBaseMeshAlgo ()
+  virtual ~BRepMesh_CustomBaseMeshAlgo ()
   {
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
 
 protected:
 
@@ -49,12 +49,35 @@ protected:
   Standard_EXPORT virtual void generateMesh () Standard_OVERRIDE
   {
     const Handle (BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure ();
+    const Standard_Integer aNodesNb = aStructure->NbNodes ();
+
     buildBaseTriangulation ();
 
     std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes ());
     BRepMesh_Delaun aMesher (aStructure, aCellsCount.first, aCellsCount.second, Standard_False);
+
+    const Standard_Integer aNewNodesNb = aStructure->NbNodes ();
+    const Standard_Boolean isRemoveAux = aNewNodesNb > aNodesNb;
+    if (isRemoveAux)
+    {
+      IMeshData::VectorOfInteger aAuxVertices (aNewNodesNb - aNodesNb);
+      for (Standard_Integer aExtNodesIt = aNodesNb + 1; aExtNodesIt <= aNewNodesNb; ++aExtNodesIt)
+      {
+        aAuxVertices.Append (aExtNodesIt);
+      }
+
+      // Set aux vertices if there are some to clean up mesh correctly.
+      aMesher.SetAuxVertices (aAuxVertices);
+    }
+
     aMesher.ProcessConstraints ();
 
+    // Destruction of triangles containing aux vertices added (possibly) during base mesh computation.
+    if (isRemoveAux)
+    {
+      aMesher.RemoveAuxElements ();
+    }
+
     BRepMesh_MeshTool aCleaner (aStructure);
     aCleaner.EraseFreeLinks ();
 
index 6bde7b90a8903c2c121d872068f752990f81eca9..c9d54fc6ddfbcde97efd389c73d848b7527766dc 100644 (file)
@@ -19,7 +19,7 @@
 class BRepMesh_DataStructureOfDelaun;
 class BRepMesh_Delaun;
 
-//! Class provides base fuctionality to build face triangulation using custom
+//! Class provides base functionality to build face triangulation using custom
 //! triangulation algorithm with possibility to modify final mesh.
 //! Performs generation of mesh using raw data from model.
 template<class BaseAlgo>
@@ -42,11 +42,11 @@ protected:
   //! Perfroms processing of generated mesh.
   virtual void postProcessMesh(BRepMesh_Delaun& theMesher)
   {
-    BaseAlgo::postProcessMesh (theMesher);
-
     const Handle(BRepMesh_DataStructureOfDelaun)& aStructure  = this->getStructure();
     std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes());
     theMesher.InitCirclesTool (aCellsCount.first, aCellsCount.second);
+
+    BaseAlgo::postProcessMesh (theMesher);
   }
 };
 
index 7a49413c9567d876912ac3ac2bad1794b3de27bf..e69a110dc96c9ba38d9405a5294d2dfd1d1e689e 100644 (file)
@@ -24,6 +24,8 @@
 #include <BRepTools.hxx>
 #include <Standard_ErrorHandler.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DataStructureOfDelaun, Standard_Transient)
+
 //=======================================================================
 //function : BRepMesh_DataStructureOfDelaun
 //purpose  : 
index cc6b714153a17fe8744dadfa0abc7d1b8926ab27..e190e17a8f4298158966295132759ae2282f211a 100644 (file)
@@ -42,7 +42,7 @@ public:
 public: //! @name API for accessing mesh nodes.
 
   //! Returns number of nodes.
-  inline Standard_Integer NbNodes() const
+  Standard_Integer NbNodes() const
   {
     return myNodes->Extent();
   }
@@ -68,7 +68,7 @@ public: //! @name API for accessing mesh nodes.
   //! Get node by the index.
   //! @param theIndex index of a node.
   //! @return node with the given index.
-  inline const BRepMesh_Vertex& GetNode(const Standard_Integer theIndex)
+  const BRepMesh_Vertex& GetNode(const Standard_Integer theIndex)
   {
     return myNodes->FindKey(theIndex);
   }
@@ -105,7 +105,7 @@ public: //! @name API for accessing mesh nodes.
   //! Get list of links attached to the node with the given index.
   //! @param theIndex index of node whose links should be retrieved.
   //! @return list of links attached to the node.
-  inline const IMeshData::ListOfInteger& LinksConnectedTo(
+  const IMeshData::ListOfInteger& LinksConnectedTo(
     const Standard_Integer theIndex) const
   {
     return linksConnectedTo(theIndex);
@@ -115,7 +115,7 @@ public: //! @name API for accessing mesh nodes.
 public: //! @name API for accessing mesh links.
 
   //! Returns number of links.
-  inline Standard_Integer NbLinks() const
+  Standard_Integer NbLinks() const
   {
     return myLinks.Extent();
   }
@@ -142,7 +142,7 @@ public: //! @name API for accessing mesh links.
   }
 
   //! Returns map of indices of links registered in mesh.
-  inline const IMeshData::MapOfInteger& LinksOfDomain() const
+  const IMeshData::MapOfInteger& LinksOfDomain() const
   {
     return myLinksOfDomain;
   }
@@ -176,7 +176,7 @@ public: //! @name API for accessing mesh links.
 public: //! @name API for accessing mesh elements.
 
   //! Returns number of links.
-  inline Standard_Integer NbElements() const
+  Standard_Integer NbElements() const
   {
     return myElements.Size();
   }
@@ -195,7 +195,7 @@ public: //! @name API for accessing mesh elements.
   }
 
   //! Returns map of indices of elements registered in mesh.
-  inline const IMeshData::MapOfInteger& ElementsOfDomain() const
+  const IMeshData::MapOfInteger& ElementsOfDomain() const
   {
     return myElementsOfDomain;
   }
@@ -229,13 +229,13 @@ public: //! @name Auxilary API
   Standard_EXPORT void Statistics(Standard_OStream& theStream) const;
   
   //! Returns memory allocator used by the structure.
-  inline const Handle(NCollection_IncAllocator)& Allocator() const
+  const Handle(NCollection_IncAllocator)& Allocator() const
   {
     return myAllocator;
   }
 
   //! Gives the data structure for initialization of cell size and tolerance.
-  inline const Handle(BRepMesh_VertexTool)& Data()
+  const Handle(BRepMesh_VertexTool)& Data()
   {
     return myNodes;
   }
@@ -251,14 +251,14 @@ public: //! @name Auxilary API
     clearDeletedNodes();
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DataStructureOfDelaun, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_DataStructureOfDelaun, Standard_Transient)
 
 private: 
 
   //! Get list of links attached to the node with the given index.
   //! @param theIndex index of node whose links should be retrieved.
   //! @return list of links attached to the node.
-  inline IMeshData::ListOfInteger& linksConnectedTo(
+  IMeshData::ListOfInteger& linksConnectedTo(
     const Standard_Integer theIndex) const
   {
     return (IMeshData::ListOfInteger&)myNodeLinks.Find(theIndex);
index a72cdfec2dc8dc6c42f058f4de9fe0d07ff74d70..ae5041418e2b6d4a586026bc5e8f47eb2bd58eae 100644 (file)
@@ -18,6 +18,7 @@
 #include <GCPnts_AbscissaPoint.hxx>
 #include <GeomAdaptor_Curve.hxx>
 #include <GeomAbs_IsoType.hxx>
+#include <BRep_Tool.hxx>
 
 //=======================================================================
 // Function: Reset
@@ -125,9 +126,14 @@ void BRepMesh_DefaultRangeSplitter::computeTolerance(
   const Standard_Real aDiffU = myRangeU.second - myRangeU.first;
   const Standard_Real aDiffV = myRangeV.second - myRangeV.first;
 
+  const Standard_Real      aTolerance = BRep_Tool::Tolerance (myDFace->GetFace());
+  const Adaptor3d_Surface& aSurface   = GetSurface()->Surface();
+  const Standard_Real      aResU      = aSurface.UResolution (aTolerance);
+  const Standard_Real      aResV      = aSurface.VResolution (aTolerance);
+
   const Standard_Real aDeflectionUV = 1.e-05;
-  myTolerance.first  = Max(Min(aDeflectionUV, 0.1 * aDiffU), 1e-7 * aDiffU);
-  myTolerance.second = Max(Min(aDeflectionUV, 0.1 * aDiffV), 1e-7 * aDiffV);
+  myTolerance.first  = Max(Min(aDeflectionUV, aResU), 1e-7 * aDiffU);
+  myTolerance.second = Max(Min(aDeflectionUV, aResV), 1e-7 * aDiffV);
 }
 
 //=======================================================================
index db9229ae8639e2bde7deca185b2cfddf8d0f217b..a12333d100f7f27abde6d614fc02e7402f27bddd 100644 (file)
@@ -70,7 +70,7 @@ public:
 
   //! Returns point in 3d space corresponded to the given 
   //! point defined in parameteric space of surface.
-  inline gp_Pnt Point(const gp_Pnt2d& thePoint2d) const
+  gp_Pnt Point(const gp_Pnt2d& thePoint2d) const
   {
     return GetSurface()->Value(thePoint2d.X(), thePoint2d.Y());
   }
@@ -78,47 +78,43 @@ public:
 protected:
 
   //! Computes parametric tolerance taking length along U and V into account.
-  virtual void computeTolerance(
-    const Standard_Real theLenU,
-    const Standard_Real theLenV);
+  Standard_EXPORT virtual void computeTolerance (const Standard_Real theLenU, const Standard_Real theLenV);
 
   //! Computes parametric delta taking length along U and V and value of tolerance into account.
-  virtual void computeDelta(
-    const Standard_Real theLengthU,
-    const Standard_Real theLengthV);
+  Standard_EXPORT virtual void computeDelta (const Standard_Real theLengthU, const Standard_Real theLengthV);
 
 public:
   //! Returns face model.
-  inline const IMeshData::IFaceHandle& GetDFace() const
+  const IMeshData::IFaceHandle& GetDFace() const
   {
     return myDFace;
   }
 
   //! Returns surface.
-  inline const Handle(BRepAdaptor_HSurface)& GetSurface() const
+  const Handle(BRepAdaptor_HSurface)& GetSurface() const
   {
     return myDFace->GetSurface();
   }
 
   //! Returns U range.
-  inline const std::pair<Standard_Real, Standard_Real>& GetRangeU() const
+  const std::pair<Standard_Real, Standard_Real>& GetRangeU() const
   {
     return myRangeU;
   }
 
   //! Returns V range.
-  inline const std::pair<Standard_Real, Standard_Real>& GetRangeV() const
+  const std::pair<Standard_Real, Standard_Real>& GetRangeV() const
   {
     return myRangeV;
   }
 
   //! Returns delta.
-  inline const std::pair<Standard_Real, Standard_Real>& GetDelta () const
+  const std::pair<Standard_Real, Standard_Real>& GetDelta () const
   {
     return myDelta;
   }
 
-  inline const std::pair<Standard_Real, Standard_Real>& GetToleranceUV() const
+  const std::pair<Standard_Real, Standard_Real>& GetToleranceUV() const
   {
     return myTolerance;
   }
index 9110114056360f46c62eeb2bec796c0e8c1c3393..8d8fc97b0535224672340b1268b56c031c78a052 100644 (file)
@@ -24,6 +24,8 @@
 #include <TopExp.hxx>
 #include <TopoDS_Vertex.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_Deflection, Standard_Transient)
+
 //=======================================================================
 //function : RelativeEdgeDeflection
 //purpose  : 
@@ -145,18 +147,39 @@ void BRepMesh_Deflection::ComputeDeflection (
   }
 
   Standard_Real aFaceDeflection = 0.0;
-  if (theDFace->WiresNb () > 0)
+  if (!theParameters.ForceFaceDeflection)
   {
-    for (Standard_Integer aWireIt = 0; aWireIt < theDFace->WiresNb(); ++aWireIt)
+    if (theDFace->WiresNb () > 0)
     {
-      aFaceDeflection += theDFace->GetWire(aWireIt)->GetDeflection();
+      for (Standard_Integer aWireIt = 0; aWireIt < theDFace->WiresNb (); ++aWireIt)
+      {
+        aFaceDeflection += theDFace->GetWire (aWireIt)->GetDeflection ();
+      }
+
+      aFaceDeflection /= theDFace->WiresNb ();
     }
 
-    aFaceDeflection /= theDFace->WiresNb ();
+    aFaceDeflection = Max (2. * BRepMesh_ShapeTool::MaxFaceTolerance (
+      theDFace->GetFace ()), aFaceDeflection);
   }
+  aFaceDeflection = Max (aDeflection, aFaceDeflection);
 
-  aFaceDeflection = Max(aDeflection, aFaceDeflection);
+  theDFace->SetDeflection (aFaceDeflection);
+}
 
-  theDFace->SetDeflection (Max(2.* BRepMesh_ShapeTool::MaxFaceTolerance(
-    theDFace->GetFace()), aFaceDeflection));
+//=======================================================================
+// Function: IsConsistent
+// Purpose : 
+//=======================================================================
+Standard_Boolean BRepMesh_Deflection::IsConsistent (
+  const Standard_Real theCurrent,
+  const Standard_Real theRequired,
+  const Standard_Boolean theAllowDecrease,
+  const Standard_Real theRatio)
+{
+  // Check if the deflection of existing polygonal representation
+  // fits the required deflection.
+  Standard_Boolean isConsistent = theCurrent < (1. + theRatio) * theRequired
+         && (!theAllowDecrease || theCurrent > (1. - theRatio) * theRequired);
+  return isConsistent;
 }
index 35998a839b0467ed14eeefd4ff74e2f40458f8a7..9c15607673794917a1ba1af738cae535bcf8ed5d 100644 (file)
@@ -58,7 +58,21 @@ public:
     const IMeshData::IFaceHandle& theDFace,
     const IMeshTools_Parameters&  theParameters);
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_Deflection, Standard_Transient)
+  //! Checks if the deflection of current polygonal representation
+  //! is consistent with the required deflection.
+  //! @param theCurrent [in] Current deflection.
+  //! @param theRequired [in] Required deflection.
+  //! @param theAllowDecrease [in] Flag controlling the check. If decrease is allowed,
+  //! to be consistent the current and required deflections should be approximately the same.
+  //! If not allowed, the current deflection should be less than required.
+  //! @param theRatio [in] The ratio for comparison of the deflections (value from 0 to 1).
+  Standard_EXPORT static Standard_Boolean IsConsistent (
+    const Standard_Real theCurrent,
+    const Standard_Real theRequired,
+    const Standard_Boolean theAllowDecrease,
+    const Standard_Real theRatio = 0.1);
+
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_Deflection, Standard_Transient)
 };
 
 #endif
\ No newline at end of file
diff --git a/src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx b/src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx
new file mode 100644 (file)
index 0000000..7c637c4
--- /dev/null
@@ -0,0 +1,194 @@
+// Created on: 2019-07-05
+// Copyright (c) 2019 OPEN CASCADE SAS
+// Created by: Oleg AGASHIN
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BRepMesh_DelabellaBaseMeshAlgo.hxx>
+
+#include <BRepMesh_MeshTool.hxx>
+#include <BRepMesh_Delaun.hxx>
+#include <Message.hxx>
+#include <Message_Gravity.hxx>
+
+#include <string.h>
+#include <stdarg.h>
+
+#include "delabella.pxx"
+
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DelabellaBaseMeshAlgo, BRepMesh_CustomBaseMeshAlgo)
+
+namespace
+{
+  //! Redirect algorithm messages to OCCT messenger.
+  static int logDelabella2Occ (void* theStream, const char* theFormat, ...)
+  {
+    (void )theStream;
+    char aBuffer[1024]; // should be more than enough for Delabella messages
+
+    va_list anArgList;
+    va_start(anArgList, theFormat);
+    Vsprintf(aBuffer, theFormat, anArgList);
+    va_end(anArgList);
+
+    Message_Gravity aGravity = Message_Warning;
+    switch ((int )theFormat[1])
+    {
+      case int('E'): aGravity = Message_Fail;  break; // [ERR]
+      case int('W'): aGravity = Message_Trace; break; // [WRN]
+      case int('N'): aGravity = Message_Trace; break; // [NFO]
+    }
+    Message::Send (aBuffer, aGravity);
+    return 0;
+  }
+}
+
+//=======================================================================
+// Function: Constructor
+// Purpose :
+//=======================================================================
+BRepMesh_DelabellaBaseMeshAlgo::BRepMesh_DelabellaBaseMeshAlgo ()
+{
+}
+
+//=======================================================================
+// Function: Destructor
+// Purpose :
+//=======================================================================
+BRepMesh_DelabellaBaseMeshAlgo::~BRepMesh_DelabellaBaseMeshAlgo ()
+{
+}
+
+//=======================================================================
+//function : buildBaseTriangulation
+//purpose  :
+//=======================================================================
+void BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation()
+{
+  const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure();
+
+  Bnd_B2d aBox;
+  const Standard_Integer aNodesNb = aStructure->NbNodes ();
+  std::vector<Standard_Real> aPoints (2 * (aNodesNb + 4));
+  for (Standard_Integer aNodeIt = 0; aNodeIt < aNodesNb; ++aNodeIt)
+  {
+    const BRepMesh_Vertex& aVertex = aStructure->GetNode (aNodeIt + 1);
+
+    const size_t aBaseIdx = 2 * static_cast<size_t> (aNodeIt);
+    aPoints[aBaseIdx + 0] = aVertex.Coord ().X ();
+    aPoints[aBaseIdx + 1] = aVertex.Coord ().Y ();
+
+    aBox.Add (gp_Pnt2d(aVertex.Coord ()));
+  }
+
+  aBox.Enlarge (0.1 * (aBox.CornerMax () - aBox.CornerMin ()).Modulus ());
+  const gp_XY aMin = aBox.CornerMin ();
+  const gp_XY aMax = aBox.CornerMax ();
+
+  aPoints[2 * aNodesNb + 0] = aMin.X ();
+  aPoints[2 * aNodesNb + 1] = aMin.Y ();
+  aStructure->AddNode (BRepMesh_Vertex (
+    aPoints[2 * aNodesNb + 0],
+    aPoints[2 * aNodesNb + 1], BRepMesh_Free));
+
+  aPoints[2 * aNodesNb + 2] = aMax.X ();
+  aPoints[2 * aNodesNb + 3] = aMin.Y ();
+  aStructure->AddNode (BRepMesh_Vertex (
+    aPoints[2 * aNodesNb + 2],
+    aPoints[2 * aNodesNb + 3], BRepMesh_Free));
+
+  aPoints[2 * aNodesNb + 4] = aMax.X ();
+  aPoints[2 * aNodesNb + 5] = aMax.Y ();
+  aStructure->AddNode (BRepMesh_Vertex (
+    aPoints[2 * aNodesNb + 4],
+    aPoints[2 * aNodesNb + 5], BRepMesh_Free));
+
+  aPoints[2 * aNodesNb + 6] = aMin.X ();
+  aPoints[2 * aNodesNb + 7] = aMax.Y ();
+  aStructure->AddNode (BRepMesh_Vertex (
+    aPoints[2 * aNodesNb + 6],
+    aPoints[2 * aNodesNb + 7], BRepMesh_Free));
+
+  const Standard_Real aDiffX = (aMax.X () - aMin.X ());
+  const Standard_Real aDiffY = (aMax.Y () - aMin.Y ());
+  for (size_t i = 0; i < aPoints.size(); i += 2)
+  {
+    aPoints[i + 0] = (aPoints[i + 0] - aMin.X ()) / aDiffX - 0.5;
+    aPoints[i + 1] = (aPoints[i + 1] - aMin.Y ()) / aDiffY - 0.5;
+  }
+
+  IDelaBella* aTriangulator = IDelaBella::Create();
+  if (aTriangulator == NULL) // should never happen
+  {
+    throw Standard_ProgramError ("BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation: unable creating a triangulation algorithm");
+  }
+
+  aTriangulator->SetErrLog (logDelabella2Occ, NULL);
+  try
+  {
+    const int aVerticesNb = aTriangulator->Triangulate (
+      static_cast<int>(aPoints.size () / 2),
+      &aPoints[0], &aPoints[1], 2 * sizeof (Standard_Real));
+
+    if (aVerticesNb > 0)
+    {
+      const DelaBella_Triangle* aTrianglePtr = aTriangulator->GetFirstDelaunayTriangle();
+      while (aTrianglePtr != NULL)
+      {
+        Standard_Integer aNodes[3] = {
+          aTrianglePtr->v[0]->i + 1,
+          aTrianglePtr->v[2]->i + 1,
+          aTrianglePtr->v[1]->i + 1
+        };
+
+        Standard_Integer aEdges       [3];
+        Standard_Boolean aOrientations[3];
+        for (Standard_Integer k = 0; k < 3; ++k)
+        {
+          const BRepMesh_Edge aLink (aNodes[k], aNodes[(k + 1) % 3], BRepMesh_Free);
+
+          const Standard_Integer aLinkInfo = aStructure->AddLink (aLink);
+          aEdges       [k] = Abs (aLinkInfo);
+          aOrientations[k] = aLinkInfo > 0;
+        }
+
+        const BRepMesh_Triangle aTriangle (aEdges, aOrientations, BRepMesh_Free);
+        aStructure->AddElement (aTriangle);
+
+        aTrianglePtr = aTrianglePtr->next;
+      }
+    }
+
+    aTriangulator->Destroy ();
+    aTriangulator = NULL;
+  }
+  catch (Standard_Failure const& theException)
+  {
+    if (aTriangulator != NULL)
+    {
+      aTriangulator->Destroy ();
+      aTriangulator = NULL;
+    }
+
+    throw Standard_Failure (theException);
+  }
+  catch (...)
+  {
+    if (aTriangulator != NULL)
+    {
+      aTriangulator->Destroy ();
+      aTriangulator = NULL;
+    }
+
+    throw Standard_Failure ("BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation: exception in triangulation algorithm");
+  }
+}
diff --git a/src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.hxx b/src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.hxx
new file mode 100644 (file)
index 0000000..9d6f2e1
--- /dev/null
@@ -0,0 +1,46 @@
+// Created on: 2019-07-05
+// Copyright (c) 2019 OPEN CASCADE SAS
+// Created by: Oleg AGASHIN
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepMesh_DelabellaBaseMeshAlgo_HeaderFile
+#define _BRepMesh_DelabellaBaseMeshAlgo_HeaderFile
+
+#include <BRepMesh_CustomBaseMeshAlgo.hxx>
+#include <NCollection_Shared.hxx>
+#include <IMeshTools_Parameters.hxx>
+
+class BRepMesh_DataStructureOfDelaun;
+class BRepMesh_Delaun;
+
+//! Class provides base functionality to build face triangulation using Delabella project.
+//! Performs generation of mesh using raw data from model.
+class BRepMesh_DelabellaBaseMeshAlgo : public BRepMesh_CustomBaseMeshAlgo
+{
+public:
+
+  //! Constructor.
+  Standard_EXPORT BRepMesh_DelabellaBaseMeshAlgo ();
+
+  //! Destructor.
+  Standard_EXPORT virtual ~BRepMesh_DelabellaBaseMeshAlgo ();
+
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_DelabellaBaseMeshAlgo, BRepMesh_CustomBaseMeshAlgo)
+
+protected:
+
+  //! Builds base triangulation using Delabella project.
+  Standard_EXPORT virtual void buildBaseTriangulation() Standard_OVERRIDE;
+};
+
+#endif
diff --git a/src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.cxx b/src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.cxx
new file mode 100644 (file)
index 0000000..8b02c4a
--- /dev/null
@@ -0,0 +1,145 @@
+// Created on: 2019-07-05
+// Copyright (c) 2019 OPEN CASCADE SAS
+// Created by: Oleg AGASHIN
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BRepMesh_DelabellaMeshAlgoFactory.hxx>
+#include <BRepMesh_DefaultRangeSplitter.hxx>
+#include <BRepMesh_NURBSRangeSplitter.hxx>
+#include <BRepMesh_SphereRangeSplitter.hxx>
+#include <BRepMesh_CylinderRangeSplitter.hxx>
+#include <BRepMesh_ConeRangeSplitter.hxx>
+#include <BRepMesh_TorusRangeSplitter.hxx>
+#include <BRepMesh_DelaunayBaseMeshAlgo.hxx>
+#include <BRepMesh_DelabellaBaseMeshAlgo.hxx>
+#include <BRepMesh_CustomDelaunayBaseMeshAlgo.hxx>
+#include <BRepMesh_DelaunayNodeInsertionMeshAlgo.hxx>
+#include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx>
+#include <BRepMesh_BoundaryParamsRangeSplitter.hxx>
+
+namespace
+{
+  struct DefaultBaseMeshAlgo
+  {
+    typedef BRepMesh_DelaunayBaseMeshAlgo Type;
+  };
+
+  template<class RangeSplitter>
+  struct DefaultNodeInsertionMeshAlgo
+  {
+    typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> Type;
+  };
+
+  struct BaseMeshAlgo
+  {
+    typedef BRepMesh_DelabellaBaseMeshAlgo Type;
+  };
+
+  template<class RangeSplitter>
+  struct NodeInsertionMeshAlgo
+  {
+    typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_CustomDelaunayBaseMeshAlgo<BRepMesh_DelabellaBaseMeshAlgo> > Type;
+  };
+
+  template<class RangeSplitter>
+  struct DeflectionControlMeshAlgo
+  {
+    typedef BRepMesh_DelaunayDeflectionControlMeshAlgo<RangeSplitter, BRepMesh_CustomDelaunayBaseMeshAlgo<BRepMesh_DelabellaBaseMeshAlgo> > Type;
+  };
+}
+
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DelabellaMeshAlgoFactory, IMeshTools_MeshAlgoFactory)
+
+//=======================================================================
+// Function: Constructor
+// Purpose :
+//=======================================================================
+BRepMesh_DelabellaMeshAlgoFactory::BRepMesh_DelabellaMeshAlgoFactory ()
+{
+}
+
+//=======================================================================
+// Function: Destructor
+// Purpose :
+//=======================================================================
+BRepMesh_DelabellaMeshAlgoFactory::~BRepMesh_DelabellaMeshAlgoFactory ()
+{
+}
+
+//=======================================================================
+// Function: GetAlgo
+// Purpose :
+//=======================================================================
+Handle(IMeshTools_MeshAlgo) BRepMesh_DelabellaMeshAlgoFactory::GetAlgo(
+  const GeomAbs_SurfaceType    theSurfaceType,
+  const IMeshTools_Parameters& theParameters) const
+{
+  switch (theSurfaceType)
+  {
+  case GeomAbs_Plane:
+    return theParameters.InternalVerticesMode ?
+      new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
+      new BaseMeshAlgo::Type;
+    break;
+
+  case GeomAbs_Sphere:
+    {
+      NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type* aMeshAlgo =
+        new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type;
+      aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
+      return aMeshAlgo;
+    }
+    break;
+
+  case GeomAbs_Cylinder:
+    return theParameters.InternalVerticesMode ?
+      new DefaultNodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
+      new DefaultBaseMeshAlgo::Type;
+    break;
+
+  case GeomAbs_Cone:
+    {
+      NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type* aMeshAlgo =
+        new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type;
+      aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
+      return aMeshAlgo;
+    }
+    break;
+
+  case GeomAbs_Torus:
+    {
+      NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type* aMeshAlgo =
+        new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type;
+      aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
+      return aMeshAlgo;
+    }
+    break;
+
+  case GeomAbs_SurfaceOfRevolution:
+    {
+      DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type* aMeshAlgo =
+        new DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type;
+      aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
+      return aMeshAlgo;
+    }
+    break;
+
+  default:
+    {
+      DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type* aMeshAlgo =
+        new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type;
+      aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
+      return aMeshAlgo;
+    }
+  }
+}
diff --git a/src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.hxx b/src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.hxx
new file mode 100644 (file)
index 0000000..486e0d5
--- /dev/null
@@ -0,0 +1,44 @@
+// Created on: 2019-07-05
+// Copyright (c) 2019 OPEN CASCADE SAS
+// Created by: Oleg AGASHIN
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepMesh_DelabellaMeshAlgoFactory_HeaderFile
+#define _BRepMesh_DelabellaMeshAlgoFactory_HeaderFile
+
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+#include <GeomAbs_SurfaceType.hxx>
+#include <IMeshTools_MeshAlgoFactory.hxx>
+
+//! Implementation of IMeshTools_MeshAlgoFactory providing Delabella-based
+//! algorithms of different complexity depending on type of target surface.
+class BRepMesh_DelabellaMeshAlgoFactory : public IMeshTools_MeshAlgoFactory
+{
+public:
+
+  //! Constructor.
+  Standard_EXPORT BRepMesh_DelabellaMeshAlgoFactory ();
+
+  //! Destructor.
+  Standard_EXPORT virtual ~BRepMesh_DelabellaMeshAlgoFactory ();
+
+  //! Creates instance of meshing algorithm for the given type of surface.
+  Standard_EXPORT virtual Handle(IMeshTools_MeshAlgo) GetAlgo(
+    const GeomAbs_SurfaceType    theSurfaceType,
+    const IMeshTools_Parameters& theParameters) const Standard_OVERRIDE;
+
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_DelabellaMeshAlgoFactory, IMeshTools_MeshAlgoFactory)
+};
+
+#endif
index c87bc6ce62121fe0e2d6e897048e26ec00f75c1b..0ff9d7e38c4d3b91eae8ecf7e7ab2d5acb2a9e91 100644 (file)
@@ -34,6 +34,7 @@
 #include <NCollection_Vector.hxx>
 
 #include <algorithm>
+#include <stack>
 
 const Standard_Real AngDeviation1Deg  = M_PI/180.;
 const Standard_Real AngDeviation90Deg = 90 * AngDeviation1Deg;
@@ -70,7 +71,7 @@ namespace {
     Handle(BRepMesh_DataStructureOfDelaun) myStructure;
   };
 
-  inline void UpdateBndBox(const gp_XY& thePnt1, const gp_XY& thePnt2, Bnd_B2d& theBox)
+  void UpdateBndBox(const gp_XY& thePnt1, const gp_XY& thePnt2, Bnd_B2d& theBox)
   {
     theBox.Add( thePnt1 );
     theBox.Add( thePnt2 );
@@ -89,7 +90,9 @@ BRepMesh_Delaun::BRepMesh_Delaun (
   const Standard_Boolean                        isFillCircles)
 : myMeshData ( theOldMesh ),
   myCircles (new NCollection_IncAllocator(
-             IMeshData::MEMORY_BLOCK_SIZE_HUGE))
+             IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
+  mySupVert (3),
+  myInitCircles (Standard_False)
 {
   if (isFillCircles)
   {
@@ -103,7 +106,9 @@ BRepMesh_Delaun::BRepMesh_Delaun (
 //=======================================================================
 BRepMesh_Delaun::BRepMesh_Delaun(IMeshData::Array1OfVertexOfDelaun& theVertices)
 : myCircles (theVertices.Length(), new NCollection_IncAllocator(
-             IMeshData::MEMORY_BLOCK_SIZE_HUGE))
+             IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
+  mySupVert (3),
+  myInitCircles (Standard_False)
 {
   if ( theVertices.Length() > 2 )
   {
@@ -123,7 +128,9 @@ BRepMesh_Delaun::BRepMesh_Delaun(
   IMeshData::Array1OfVertexOfDelaun&            theVertices)
 : myMeshData( theOldMesh ),
   myCircles ( theVertices.Length(), new NCollection_IncAllocator(
-             IMeshData::MEMORY_BLOCK_SIZE_HUGE))
+             IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
+  mySupVert (3),
+  myInitCircles (Standard_False)
 {
   if ( theVertices.Length() > 2 )
   {
@@ -140,7 +147,9 @@ BRepMesh_Delaun::BRepMesh_Delaun(
   IMeshData::VectorOfInteger&                   theVertexIndices)
 : myMeshData( theOldMesh ),
   myCircles ( theVertexIndices.Length(), new NCollection_IncAllocator(
-             IMeshData::MEMORY_BLOCK_SIZE_HUGE))
+             IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
+  mySupVert (3),
+  myInitCircles (Standard_False)
 {
   perform(theVertexIndices);
 }
@@ -155,7 +164,9 @@ BRepMesh_Delaun::BRepMesh_Delaun (const Handle (BRepMesh_DataStructureOfDelaun)&
                                   const Standard_Integer                         theCellsCountV)
 : myMeshData (theOldMesh),
   myCircles (theVertexIndices.Length (), new NCollection_IncAllocator(
-             IMeshData::MEMORY_BLOCK_SIZE_HUGE))
+             IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
+  mySupVert (3),
+  myInitCircles (Standard_False)
 {
   perform (theVertexIndices, theCellsCountU, theCellsCountV);
 }
@@ -234,6 +245,8 @@ void BRepMesh_Delaun::initCirclesTool (const Bnd_Box2d&       theBox,
   myCircles.SetMinMaxSize( gp_XY( aMinX, aMinY ), gp_XY( aMaxX, aMaxY ) );
   myCircles.SetCellSize  ( aDeltaX / Max (theCellsCountU, aScaler),
                            aDeltaY / Max (theCellsCountV, aScaler));
+
+  myInitCircles = Standard_True;
 }
 
 //=======================================================================
@@ -284,14 +297,14 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
   Standard_Real aDeltaMax = Max( aDeltaX, aDeltaY );
   Standard_Real aDelta    = aDeltaX + aDeltaY;
 
-  mySupVert[0] = myMeshData->AddNode(
-    BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) );
+  mySupVert.Append (myMeshData->AddNode(
+    BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) ) );
 
-  mySupVert[1] = myMeshData->AddNode(
-    BRepMesh_Vertex( aMinX - aDelta, aMinY - aDeltaMin, BRepMesh_Free ) );
+  mySupVert.Append (myMeshData->AddNode(
+    BRepMesh_Vertex( aMinX - aDelta, aMinY - aDeltaMin, BRepMesh_Free ) ) );
 
-  mySupVert[2] = myMeshData->AddNode(
-    BRepMesh_Vertex( aMaxX + aDelta, aMinY - aDeltaMin, BRepMesh_Free ) );
+  mySupVert.Append (myMeshData->AddNode(
+    BRepMesh_Vertex( aMaxX + aDelta, aMinY - aDeltaMin, BRepMesh_Free ) ) );
 
   Standard_Integer e[3];
   Standard_Boolean o[3];
@@ -318,7 +331,7 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
 void BRepMesh_Delaun::deleteTriangle(const Standard_Integer          theIndex, 
                                      IMeshData::MapOfIntegerInteger& theLoopEdges )
 {
-  if (!myCircles.IsEmpty())
+  if (myInitCircles)
   {
     myCircles.Delete (theIndex);
   }
@@ -367,12 +380,25 @@ void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
     createTrianglesOnNewVertices( theVertexIndexes );
   }
 
+  RemoveAuxElements ();
+}
+
+//=======================================================================
+//function : RemoveAuxElements
+//purpose  :
+//=======================================================================
+void BRepMesh_Delaun::RemoveAuxElements ()
+{
+  Handle (NCollection_IncAllocator) aAllocator = new NCollection_IncAllocator (
+    IMeshData::MEMORY_BLOCK_SIZE_HUGE);
+
+  IMeshData::MapOfIntegerInteger aLoopEdges (10, aAllocator);
+
   // Destruction of triangles containing a top of the super triangle
-  BRepMesh_SelectorOfDataStructureOfDelaun aSelector( myMeshData );
-  for (Standard_Integer aSupVertId = 0; aSupVertId < 3; ++aSupVertId)
+  BRepMesh_SelectorOfDataStructureOfDelaun aSelector (myMeshData);
+  for (Standard_Integer aSupVertId = 0; aSupVertId < mySupVert.Size(); ++aSupVertId)
     aSelector.NeighboursOfNode( mySupVert[aSupVertId] );
-  
-  aLoopEdges.Clear();
+
   IMeshData::IteratorOfMapOfInteger aFreeTriangles( aSelector.Elements() );
   for ( ; aFreeTriangles.More(); aFreeTriangles.Next() )
     deleteTriangle( aFreeTriangles.Key(), aLoopEdges );
@@ -387,7 +413,7 @@ void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
   }
 
   // The tops of the super triangle are destroyed
-  for (Standard_Integer aSupVertId = 0; aSupVertId < 3; ++aSupVertId)
+  for (Standard_Integer aSupVertId = 0; aSupVertId < mySupVert.Size (); ++aSupVertId)
     myMeshData->RemoveNode( mySupVert[aSupVertId] );
 }
 
@@ -610,7 +636,7 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
 //=======================================================================
 void BRepMesh_Delaun::insertInternalEdges()
 {
-  Handle(IMeshData::MapOfInteger) anInternalEdges = InternalEdges();;
+  Handle(IMeshData::MapOfInteger) anInternalEdges = InternalEdges();
 
   // Destruction of triancles intersecting internal edges 
   // and their replacement by makeshift triangles
@@ -652,53 +678,56 @@ void BRepMesh_Delaun::insertInternalEdges()
 
 //=======================================================================
 //function : isBoundToFrontier
-//purpose  : Goes through the neighbour triangles around the given node 
-//           started from the given link, returns TRUE if some triangle 
-//           has a bounding frontier edge or FALSE elsewhere.
-//           Stop link is used to prevent cycles.
-//           Previous element Id is used to identify next neighbor element.
+//purpose  : 
 //=======================================================================
 Standard_Boolean BRepMesh_Delaun::isBoundToFrontier(
   const Standard_Integer theRefNodeId,
-  const Standard_Integer theRefLinkId,
-  const Standard_Integer theStopLinkId,
-  const Standard_Integer thePrevElementId)
+  const Standard_Integer theRefLinkId)
 {
-  const BRepMesh_PairOfIndex& aPair = 
-    myMeshData->ElementsConnectedTo( theRefLinkId );
-  if ( aPair.IsEmpty() )
-    return Standard_False;
+  std::stack<Standard_Integer> aLinkStack;
+  TColStd_PackedMapOfInteger   aVisitedLinks;
 
-  Standard_Integer aNbElements = aPair.Extent();
-  for ( Standard_Integer anElemIt = 1; anElemIt <= aNbElements; ++anElemIt )
+  aLinkStack.push (theRefLinkId);
+  while (!aLinkStack.empty ())
   {
-    const Standard_Integer aTriId = aPair.Index(anElemIt);
-    if ( aTriId < 0 || aTriId == thePrevElementId )
-      continue;
+    const Standard_Integer aCurrentLinkId = aLinkStack.top ();
+    aLinkStack.pop ();
 
-    const BRepMesh_Triangle& aElement = GetTriangle(aTriId);
-    const Standard_Integer(&anEdges)[3] = aElement.myEdges;
+    const BRepMesh_PairOfIndex& aPair = myMeshData->ElementsConnectedTo (aCurrentLinkId);
+    if (aPair.IsEmpty ())
+      return Standard_False;
 
-    for ( Standard_Integer anEdgeIt = 0; anEdgeIt < 3; ++anEdgeIt )
+    const Standard_Integer aNbElements = aPair.Extent ();
+    for (Standard_Integer anElemIt = 1; anElemIt <= aNbElements; ++anElemIt)
     {
-      const Standard_Integer anEdgeId = anEdges[anEdgeIt];
-      if ( anEdgeId == theRefLinkId )
+      const Standard_Integer aTriId = aPair.Index (anElemIt);
+      if (aTriId < 0)
         continue;
 
-      if ( anEdgeId == theStopLinkId )
-        return Standard_False;
+      const BRepMesh_Triangle& aElement = GetTriangle (aTriId);
+      const Standard_Integer (&anEdges)[3] = aElement.myEdges;
 
-      const BRepMesh_Edge& anEdge = GetEdge( anEdgeId );
-      if ( anEdge.FirstNode() != theRefNodeId &&
-           anEdge.LastNode()  != theRefNodeId )
+      for (Standard_Integer anEdgeIt = 0; anEdgeIt < 3; ++anEdgeIt)
       {
-        continue;
-      }
+        const Standard_Integer anEdgeId = anEdges[anEdgeIt];
+        if (anEdgeId == aCurrentLinkId)
+          continue;
+
+        const BRepMesh_Edge& anEdge = GetEdge (anEdgeId);
+        if (anEdge.FirstNode () != theRefNodeId &&
+            anEdge.LastNode  () != theRefNodeId)
+        {
+          continue;
+        }
 
-      if ( anEdge.Movability() != BRepMesh_Free )
-        return Standard_True;
+        if (anEdge.Movability () != BRepMesh_Free)
+          return Standard_True;
 
-      return isBoundToFrontier( theRefNodeId, anEdgeId, theStopLinkId, aTriId );
+        if (aVisitedLinks.Add (anEdgeId))
+        {
+          aLinkStack.push (anEdgeId);
+        }
+      }
     }
   }
 
@@ -771,9 +800,7 @@ void BRepMesh_Delaun::cleanupMesh()
               myMeshData->ElementNodes (aCurTriangle, v);
               for (int aNodeIdx = 0; aNodeIdx < 3 && isCanNotBeRemoved; ++aNodeIdx)
               {
-                if (v[aNodeIdx] == mySupVert[0] ||
-                    v[aNodeIdx] == mySupVert[1] ||
-                    v[aNodeIdx] == mySupVert[2])
+                if (isSupVertex (v[aNodeIdx]))
                 {
                   isCanNotBeRemoved = Standard_False;
                 }
@@ -792,8 +819,7 @@ void BRepMesh_Delaun::cleanupMesh()
       for ( Standard_Integer aLinkNodeIt = 0; aLinkNodeIt < 2; ++aLinkNodeIt )
       {
         isConnected[aLinkNodeIt] = isBoundToFrontier( ( aLinkNodeIt == 0 ) ? 
-          anEdge.FirstNode() : anEdge.LastNode(), 
-          aFreeEdgeId, aFreeEdgeId, -1);
+          anEdge.FirstNode() : anEdge.LastNode(), aFreeEdgeId);
       }
 
       if ( !isConnected[0] || !isConnected[1] )
@@ -1224,19 +1250,23 @@ Standard_Boolean BRepMesh_Delaun::checkIntersection(
 //function : addTriangle
 //purpose  : Add a triangle based on the given oriented edges into mesh
 //=======================================================================
-inline void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
-                                          const Standard_Boolean (&theEdgesOri)[3],
-                                          const Standard_Integer (&theNodesId)[3] )
+void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
+                                   const Standard_Boolean (&theEdgesOri)[3],
+                                   const Standard_Integer (&theNodesId)[3] )
 {
   Standard_Integer aNewTriangleId = 
     myMeshData->AddElement(BRepMesh_Triangle(theEdgesId, 
       theEdgesOri, BRepMesh_Free));
 
-  Standard_Boolean isAdded = myCircles.Bind( 
-    aNewTriangleId,
-    GetVertex( theNodesId[0] ).Coord(), 
-    GetVertex( theNodesId[1] ).Coord(),
-    GetVertex( theNodesId[2] ).Coord() );
+  Standard_Boolean isAdded = Standard_True;
+  if (myInitCircles)
+  {
+    isAdded = myCircles.Bind( 
+      aNewTriangleId,
+      GetVertex( theNodesId[0] ).Coord(), 
+      GetVertex( theNodesId[1] ).Coord(),
+      GetVertex( theNodesId[2] ).Coord() );
+  }
     
   if ( !isAdded )
     myMeshData->RemoveElement( aNewTriangleId );
@@ -1890,7 +1920,7 @@ void BRepMesh_Delaun::meshPolygon(IMeshData::SequenceOfInteger&   thePolygon,
 //function : meshElementaryPolygon
 //purpose  : Triangulation of closed polygon containing only three edges.
 //=======================================================================
-inline Standard_Boolean BRepMesh_Delaun::meshElementaryPolygon( 
+Standard_Boolean BRepMesh_Delaun::meshElementaryPolygon(
   const IMeshData::SequenceOfInteger& thePolygon)
 {
   Standard_Integer aPolyLen = thePolygon.Length();
index f03a333a1120121a43a2b3363bc67daf564dfbb3..9cc95fdb7513e2d5756be5bf308fde2d1e571e1c 100755 (executable)
@@ -82,13 +82,13 @@ public:
   Standard_EXPORT Standard_Boolean UseEdge (const Standard_Integer theEdge);
 
   //! Gives the Mesh data structure.
-  inline const Handle(BRepMesh_DataStructureOfDelaun)& Result() const
+  const Handle(BRepMesh_DataStructureOfDelaun)& Result() const
   {
     return myMeshData;
   }
 
   //! Forces insertion of constraint edges into the base triangulation. 
-  inline void ProcessConstraints()
+  void ProcessConstraints()
   {
     insertInternalEdges();
 
@@ -97,43 +97,43 @@ public:
   }
 
   //! Gives the list of frontier edges.
-  inline Handle(IMeshData::MapOfInteger) Frontier() const
+  Handle(IMeshData::MapOfInteger) Frontier() const
   {
     return getEdgesByType (BRepMesh_Frontier);
   }
 
   //! Gives the list of internal edges.
-  inline Handle(IMeshData::MapOfInteger) InternalEdges() const
+  Handle(IMeshData::MapOfInteger) InternalEdges() const
   {
     return getEdgesByType (BRepMesh_Fixed);
   }
 
   //! Gives the list of free edges used only one time
-  inline Handle(IMeshData::MapOfInteger) FreeEdges() const
+  Handle(IMeshData::MapOfInteger) FreeEdges() const
   {
     return getEdgesByType (BRepMesh_Free);
   }
 
   //! Gives vertex with the given index
-  inline const BRepMesh_Vertex& GetVertex (const Standard_Integer theIndex) const
+  const BRepMesh_Vertex& GetVertex (const Standard_Integer theIndex) const
   {
     return myMeshData->GetNode (theIndex);
   }
 
   //! Gives edge with the given index
-  inline const BRepMesh_Edge& GetEdge (const Standard_Integer theIndex) const
+  const BRepMesh_Edge& GetEdge (const Standard_Integer theIndex) const
   {
     return myMeshData->GetLink (theIndex);
   }
 
   //! Gives triangle with the given index
-  inline const BRepMesh_Triangle& GetTriangle (const Standard_Integer theIndex) const
+  const BRepMesh_Triangle& GetTriangle (const Standard_Integer theIndex) const
   {
     return myMeshData->GetElement (theIndex);
   }
 
   //! Returns tool used to build mesh consistent to Delaunay criteria.
-  inline const BRepMesh_CircleTool& Circles() const
+  const BRepMesh_CircleTool& Circles() const
   {
     return myCircles;
   }
@@ -147,6 +147,17 @@ public:
                                              const Standard_Real    theSqTolerance,
                                              Standard_Integer&      theEdgeOn) const;
 
+  //! Explicitly sets ids of auxiliary vertices used to build mesh and used by 3rd-party algorithms.
+  inline void SetAuxVertices (const IMeshData::VectorOfInteger& theSupVert)
+  {
+    mySupVert = theSupVert;
+  }
+
+  //! Destruction of auxiliary triangles containing the given vertices.
+  //! Removes auxiliary vertices also.
+  //! @param theAuxVertices auxiliary vertices to be cleaned up.
+  Standard_EXPORT void RemoveAuxElements ();
+
 private:
 
   enum ReplaceFlag
@@ -247,16 +258,16 @@ private:
     IMeshData::SequenceOfBndB2d&  thePolyBoxesCut);
 
   //! Triangulation of closed polygon containing only three edges.
-  inline Standard_Boolean meshElementaryPolygon (const IMeshData::SequenceOfInteger& thePolygon);
+  Standard_Boolean meshElementaryPolygon (const IMeshData::SequenceOfInteger& thePolygon);
 
   //! Creates the triangles beetween the given node and the given polyline.
   void createTriangles (const Standard_Integer         theVertexIndex,
                         IMeshData::MapOfIntegerInteger& thePoly);
 
   //! Add a triangle based on the given oriented edges into mesh
-  inline void addTriangle (const Standard_Integer (&theEdgesId)[3],
-                           const Standard_Boolean (&theEdgesOri)[3],
-                           const Standard_Integer (&theNodesId)[3]);
+  void addTriangle (const Standard_Integer (&theEdgesId)[3],
+                    const Standard_Boolean (&theEdgesOri)[3],
+                    const Standard_Integer (&theNodesId)[3]);
 
   //! Deletes the triangle with the given index and adds the free edges into the map.
   //! When an edge is suppressed more than one time it is destroyed.
@@ -292,12 +303,8 @@ private:
   //! Goes through the neighbour triangles around the given node started
   //! from the given link, returns TRUE if some triangle has a bounding
   //! frontier edge or FALSE elsewhere.
-  //! Stop link is used to prevent cycles.
-  //! Previous element Id is used to identify next neighbor element.
   Standard_Boolean isBoundToFrontier (const Standard_Integer theRefNodeId,
-                                      const Standard_Integer theRefLinkId,
-                                      const Standard_Integer theStopLinkId,
-                                      const Standard_Integer thePrevElementId);
+                                      const Standard_Integer theRefLinkId);
 
   //! Remove internal triangles from the given polygon.
   void cleanupPolygon (const IMeshData::SequenceOfInteger& thePolygon,
@@ -354,13 +361,27 @@ private:
   //! Performs insertion of internal edges into mesh.
   void insertInternalEdges();
 
+  //! Checks whether the given vertex id relates to super contour.
+  Standard_Boolean isSupVertex (const Standard_Integer theVertexIdx) const
+  {
+    for (IMeshData::VectorOfInteger::Iterator aIt (mySupVert); aIt.More (); aIt.Next ())
+    {
+      if (theVertexIdx == aIt.Value ())
+      {
+        return Standard_True;
+      }
+    }
+
+    return Standard_False;
+  }
+
 private:
 
   Handle(BRepMesh_DataStructureOfDelaun) myMeshData;
   BRepMesh_CircleTool                    myCircles;
-  Standard_Integer                       mySupVert[3];
+  IMeshData::VectorOfInteger             mySupVert;
+  Standard_Boolean                       myInitCircles;
   BRepMesh_Triangle                      mySupTrian;
-
 };
 
 #endif
index 1394bd7a4afa06ad904b1ac34848f5962f602742..01b22c1e75b966892073d2d34f4d59093091c6b9 100644 (file)
@@ -17,6 +17,8 @@
 #include <BRepMesh_MeshTool.hxx>
 #include <BRepMesh_Delaun.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index 81bfdc7c9fd7465e1d11beaf8492686027ce5d80..8daea798528fbe39a084c26bc7c27f9de45ea4d8 100644 (file)
@@ -23,7 +23,7 @@
 class BRepMesh_DataStructureOfDelaun;
 class BRepMesh_Delaun;
 
-//! Class provides base fuctionality to build face triangulation using Dealunay approach.
+//! Class provides base functionality to build face triangulation using Dealunay approach.
 //! Performs generation of mesh using raw data from model.
 class BRepMesh_DelaunayBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
 {
@@ -35,7 +35,7 @@ public:
   //! Destructor.
   Standard_EXPORT virtual ~BRepMesh_DelaunayBaseMeshAlgo();
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
 
 protected:
 
index 04f4708d661dd3b9b38a62245eabaa43de540e78..5f43fa9f579da80edd4083bf0087b1fd2f15ec56 100644 (file)
@@ -34,7 +34,8 @@ public:
   //! Constructor.
   BRepMesh_DelaunayDeflectionControlMeshAlgo()
     : myMaxSqDeflection(-1.),
-      myIsAllDegenerated(Standard_False)
+      myIsAllDegenerated(Standard_False),
+      myCircles(NULL)
   {
   }
 
@@ -107,6 +108,11 @@ private:
   //! Contains geometrical data related to node of triangle.
   struct TriangleNodeInfo
   {
+    TriangleNodeInfo()
+    : isFrontierLink(Standard_False)
+    {
+    }
+
     gp_XY            Point2d;
     gp_XYZ           Point;
     Standard_Boolean isFrontierLink;
@@ -172,7 +178,7 @@ private:
   };
 
   //! Returns nodes info of the given triangle.
-  inline void getTriangleInfo(
+  void getTriangleInfo(
     const BRepMesh_Triangle& theTriangle,
     const Standard_Integer (&theNodesIndices)[3],
     TriangleNodeInfo       (&theInfo)[3]) const
@@ -216,7 +222,7 @@ private:
 
   //! Updates array of links vectors.
   //! @return False on degenerative triangle.
-  inline Standard_Boolean computeTriangleGeometry(
+  Standard_Boolean computeTriangleGeometry(
     const TriangleNodeInfo(&theNodesInfo)[3],
     gp_Vec                (&theLinks)[3],
     gp_Vec                 &theNormal)
@@ -237,7 +243,7 @@ private:
 
   //! Updates array of links vectors.
   //! @return False on degenerative triangle.
-  inline Standard_Boolean checkTriangleForDegenerativityAndGetLinks(
+  Standard_Boolean checkTriangleForDegenerativityAndGetLinks(
     const TriangleNodeInfo (&theNodesInfo)[3],
     gp_Vec                 (&theLinks)[3])
   {
@@ -256,7 +262,7 @@ private:
 
   //! Checks area of triangle in parametric space for degenerativity.
   //! @return False on degenerative triangle.
-  inline Standard_Boolean checkTriangleArea2d(
+  Standard_Boolean checkTriangleArea2d(
     const TriangleNodeInfo (&theNodesInfo)[3])
   {
     const gp_Vec2d aLink2d1(theNodesInfo[0].Point2d, theNodesInfo[1].Point2d);
@@ -268,9 +274,9 @@ private:
 
   //! Computes normal using two link vectors.
   //! @return True on success, False in case of normal of null magnitude.
-  inline Standard_Boolean computeNormal(const gp_Vec& theLink1,
-                                        const gp_Vec& theLink2,
-                                        gp_Vec&       theNormal)
+  Standard_Boolean computeNormal(const gp_Vec& theLink1,
+                                 const gp_Vec& theLink2,
+                                 gp_Vec&       theNormal)
   {
     const gp_Vec aNormal(theLink1 ^ theLink2);
     if (aNormal.SquareMagnitude() > gp::Resolution())
@@ -284,7 +290,7 @@ private:
 
   //! Computes deflection of midpoints of triangles links.
   //! @return True if point fits specified deflection.
-  inline void splitLinks(
+  void splitLinks(
     const TriangleNodeInfo (&theNodesInfo)[3],
     const Standard_Integer (&theNodesIndices)[3])
   {
@@ -364,7 +370,7 @@ private:
   //! insertion in case if it overflows deflection.
   //! @return True if point has been cached for insertion.
   template<class DeflectionFunctor>
-  inline Standard_Boolean usePoint(
+  Standard_Boolean usePoint(
     const gp_XY&             thePnt2d,
     const DeflectionFunctor& theDeflectionFunctor)
   {
index ccbe55278e2013b386dd0c0825b60ed782a6bb4a..6f1a32a81e63c8ddfe19acb7b273a1ddb3ca5ebc 100644 (file)
@@ -42,7 +42,7 @@ public:
   }
 
   //! Returns PreProcessSurfaceNodes flag. 
-  inline Standard_Boolean IsPreProcessSurfaceNodes () const
+  Standard_Boolean IsPreProcessSurfaceNodes () const
   {
     return myIsPreProcessSurfaceNodes;
   }
@@ -50,7 +50,7 @@ public:
   //! Sets PreProcessSurfaceNodes flag.
   //! If TRUE, registers surface nodes before generation of base mesh.
   //! If FALSE, inserts surface nodes after generation of base mesh. 
-  inline void SetPreProcessSurfaceNodes (const Standard_Boolean isPreProcessSurfaceNodes)
+  void SetPreProcessSurfaceNodes (const Standard_Boolean isPreProcessSurfaceNodes)
   {
     myIsPreProcessSurfaceNodes = isPreProcessSurfaceNodes;
   }
index a5f47d31112f9df783255d935c8bbf64ae5a033b..4f7af9ba21c5015f5f3e0df06633d432de2a6d8b 100644 (file)
@@ -39,7 +39,7 @@ public:
   Standard_EXPORT static BRepMesh_DiscretFactory& Get();
   
   //! Returns the list of registered meshing algorithms.
-  inline const TColStd_MapOfAsciiString& Names() const
+  const TColStd_MapOfAsciiString& Names() const
   {
     return myNames;
   }
@@ -53,7 +53,7 @@ public:
   }
   
   //! Returns name for current meshing algorithm.
-  inline const TCollection_AsciiString& DefaultName() const
+  const TCollection_AsciiString& DefaultName() const
   {
     return myDefaultName;
   }
@@ -67,13 +67,13 @@ public:
   }
   
   //! Returns function name that should be exported by plugin.
-  inline const TCollection_AsciiString& FunctionName() const
+  const TCollection_AsciiString& FunctionName() const
   {
     return myFunctionName;
   }
   
   //! Returns error status for last meshing algorithm switch.
-  inline BRepMesh_FactoryError ErrorStatus() const
+  BRepMesh_FactoryError ErrorStatus() const
   {
     return myErrorStatus;
   }
index 361cf0e242a67eca37094bff830d28d89d47814d..2ee8c4be26eb693c6589f50ffa090e8d94215a40 100644 (file)
@@ -29,18 +29,18 @@ public:
   Standard_EXPORT virtual ~BRepMesh_DiscretRoot();
 
   //! Set the shape to triangulate.
-  inline void SetShape(const TopoDS_Shape& theShape)
+  void SetShape(const TopoDS_Shape& theShape)
   {
     myShape = theShape;
   }
   
-  inline const TopoDS_Shape& Shape() const
+  const TopoDS_Shape& Shape() const
   {
     return myShape;
   }
   
   //! Returns true if triangualtion was performed and has success.
-  inline Standard_Boolean IsDone() const
+  Standard_Boolean IsDone() const
   {
     return myIsDone;
   }
@@ -57,13 +57,13 @@ protected:
   Standard_EXPORT BRepMesh_DiscretRoot();
   
   //! Sets IsDone flag.
-  inline void setDone()
+  void setDone()
   {
     myIsDone = Standard_True;
   }
   
   //! Clears IsDone flag.
-  inline void setNotDone()
+  void setNotDone()
   {
     myIsDone = Standard_False;
   }
index 3ef815131180499b3be2312b04fd302dda4424a2..b46056bffc45f6c7021a88e2557dc1b1823ab7e1 100644 (file)
@@ -43,14 +43,14 @@ public:
   }
 
   //! Returns movability flag of the Link.
-  inline BRepMesh_DegreeOfFreedom Movability() const
+  BRepMesh_DegreeOfFreedom Movability() const
   {
     return myMovability;
   }
 
   //! Sets movability flag of the Link.
   //! @param theMovability flag to be set.
-  inline void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
+  void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
   {
     myMovability = theMovability;
   }
@@ -58,7 +58,7 @@ public:
   //! Checks if the given edge and this one have the same orientation.
   //! @param theOther edge to be checked against this one.
   //! \retrun TRUE if edges have the same orientation, FALSE if not.
-  inline Standard_Boolean IsSameOrientation(const BRepMesh_Edge& theOther) const
+  Standard_Boolean IsSameOrientation(const BRepMesh_Edge& theOther) const
   {
     return BRepMesh_OrientedEdge::IsEqual(theOther);
   }
@@ -66,7 +66,7 @@ public:
   //! Checks for equality with another edge.
   //! @param theOther edge to be checked against this one.
   //! @return TRUE if equal, FALSE if not.
-  inline Standard_Boolean IsEqual(const BRepMesh_Edge& theOther) const
+  Standard_Boolean IsEqual(const BRepMesh_Edge& theOther) const
   {
     if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
       return Standard_False;
@@ -76,7 +76,7 @@ public:
   }
 
   //! Alias for IsEqual.
-  inline Standard_Boolean operator ==(const BRepMesh_Edge& Other) const
+  Standard_Boolean operator ==(const BRepMesh_Edge& Other) const
   {
     return IsEqual(Other);
   }
index d9e575af43b9b0faffae33733bb110b6d4f7c312..31146b6d6af9327e982eb0b4f222ea919c891b62 100644 (file)
@@ -26,6 +26,8 @@
 #include <BRepMesh_CurveTessellator.hxx>
 #include <OSD_Parallel.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
@@ -155,8 +157,10 @@ void BRepMesh_EdgeDiscret::process (const Standard_Integer theEdgeIndex) const
       const Handle (Poly_Polygon3D)& aPoly3D = BRep_Tool::Polygon3D (aDEdge->GetEdge (), aLoc);
       if (!aPoly3D.IsNull ())
       {
-        if (aPoly3D->HasParameters () &&
-            aPoly3D->Deflection () < 1.1 * aDEdge->GetDeflection ())
+        if (aPoly3D->HasParameters() &&
+            BRepMesh_Deflection::IsConsistent (aPoly3D->Deflection(),
+                                               aDEdge->GetDeflection(),
+                                               myParameters.AllowQualityDecrease))
         {
           // Edge already has suitable 3d polygon.
           aDEdge->SetStatus(IMeshData_Reused);
@@ -209,8 +213,10 @@ Standard_Real BRepMesh_EdgeDiscret::checkExistingPolygonAndUpdateStatus(
 
   if (!aPolygon.IsNull ())
   {
-    Standard_Boolean isConsistent = aPolygon->HasParameters () &&
-      aPolygon->Deflection () < 1.1 * theDEdge->GetDeflection ();
+    Standard_Boolean isConsistent = aPolygon->HasParameters() &&
+      BRepMesh_Deflection::IsConsistent (aPolygon->Deflection(),
+                                         theDEdge->GetDeflection(),
+                                         myParameters.AllowQualityDecrease);
 
     if (!isConsistent)
     {
index 82ac8e48d2cd0b598cc8709a3f73815f6766fba2..7dcb197ff057cd97850654436e28bba3ba20734f 100644 (file)
@@ -53,7 +53,7 @@ public:
     const IMeshData::IFaceHandle& theDFace);
 
   //! Functor API to discretize the given edge.
-  inline void operator() (const Standard_Integer theEdgeIndex) const {
+  void operator() (const Standard_Integer theEdgeIndex) const {
     process (theEdgeIndex);
   }
 
@@ -68,7 +68,7 @@ public:
     const IMeshData::IEdgeHandle& theDEdge,
     const Standard_Boolean        theUpdateEnds);
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo)
 
 protected:
 
index 64610fef1e497756bc038faa26682e423ce7d124..7d73cbe922e79e537a3013c51af37959efb7df8f 100644 (file)
@@ -45,6 +45,12 @@ public:
 
   //! Constructor. Initializes empty provider.
   BRepMesh_EdgeParameterProvider()
+  : myIsSameParam(Standard_False),
+    myFirstParam(0.0),
+    myOldFirstParam(0.0),
+    myScale(0.0),
+    myCurParam(0.0),
+    myFoundParam(0.0)
   {
   }
 
index 5e2748042d89d9f5559d35ae57b0aba5d7c536ed..6f9e1ab8bbf4c0f4136e81f884618ebd6818d93c 100644 (file)
@@ -20,6 +20,8 @@
 #include <IMeshData_Face.hxx>
 #include <IMeshData_Edge.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_EdgeTessellationExtractor, IMeshTools_CurveTessellator)
+
 //=======================================================================
 //function : Constructor
 //purpose  : 
index 8ce07f590f43cb50cc783427dad96fee578b553f..48e0a915bf7336ec042574eba1fe4074639eb0ef 100644 (file)
@@ -50,7 +50,7 @@ public:
     gp_Pnt&                thePoint,
     Standard_Real&         theParameter) const Standard_OVERRIDE;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_EdgeTessellationExtractor, IMeshTools_CurveTessellator)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_EdgeTessellationExtractor, IMeshTools_CurveTessellator)
 
 private:
 
index cc2491df7029fc6f069e992e082903ea5b3b5659..b78238d692857d6fc3910d8cd37f3e7fda43eddc 100644 (file)
@@ -19,6 +19,8 @@
 #include <OSD_Parallel.hxx>
 #include <BRepMesh_GeomTool.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceChecker, Standard_Transient)
+
 namespace
 {
   const Standard_Real MaxTangentAngle = 5. * M_PI / 180.;
@@ -103,6 +105,7 @@ namespace
     BndBox2dTreeSelector(const Standard_Real theTolerance)
       : myMaxLoopSize(M_PI * theTolerance * theTolerance),
         mySelfSegmentIndex(-1),
+        mySegment(0),
         myIndices(256, new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE))
     {
     }
index 93f574a45d208b5bed61f37442a846fbe8e5401e..b0597ed5adee12288fdcfc1600055e0733bf7cee 100644 (file)
@@ -38,8 +38,9 @@ public: //! @name mesher API
     gp_Pnt2d*                Point2; // / using indices.
 
     Segment()
-      : Point1(NULL)
-      , Point2(NULL)
+    : EdgePtr(NULL),
+      Point1(NULL),
+      Point2(NULL)
     {
     }
 
@@ -77,17 +78,17 @@ public: //! @name mesher API
   }
 
   //! Checks wire with the given index for intersection with others.
-  inline void operator()(const Standard_Integer theWireIndex) const
+  void operator()(const Standard_Integer theWireIndex) const
   {
     perform(theWireIndex);
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceChecker, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_FaceChecker, Standard_Transient)
 
 private:
 
   //! Returns True in case if check can be performed in parallel mode.
-  inline Standard_Boolean isParallel() const
+  Standard_Boolean isParallel() const
   {
     return (myParameters.InParallel && myDFace->WiresNb() > 1);
   }
index ce6db2102e1c3271f551bd0b813a28148ad571e8..236355738675ffbcc1d127473c681b8404990404 100644 (file)
@@ -21,6 +21,8 @@
 #include <IMeshTools_MeshAlgo.hxx>
 #include <OSD_Parallel.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
@@ -39,6 +41,24 @@ BRepMesh_FaceDiscret::~BRepMesh_FaceDiscret()
 {
 }
 
+//! Auxiliary functor for parallel processing of Faces.
+class BRepMesh_FaceDiscret::FaceListFunctor
+{
+public:
+  FaceListFunctor (BRepMesh_FaceDiscret* theAlgo)
+  : myAlgo (theAlgo)
+  {
+  }
+
+  void operator() (const Standard_Integer theFaceIndex) const
+  {
+    myAlgo->process(theFaceIndex);
+  }
+
+private:
+  mutable BRepMesh_FaceDiscret* myAlgo;
+};
+
 //=======================================================================
 // Function: Perform
 // Purpose : 
@@ -54,7 +74,8 @@ Standard_Boolean BRepMesh_FaceDiscret::performInternal(
     return Standard_False;
   }
 
-  OSD_Parallel::For(0, myModel->FacesNb(), *this, !(myParameters.InParallel && myModel->FacesNb() > 1));
+  FaceListFunctor aFunctor(this);
+  OSD_Parallel::For(0, myModel->FacesNb(), aFunctor, !(myParameters.InParallel && myModel->FacesNb() > 1));
 
   myModel.Nullify(); // Do not hold link to model.
   return Standard_True;
index 9ca86800b637fbe32e61b144f2691c0439f92fdc..be422376fccdbb52eebc6a519717eb3dc542d9c6 100644 (file)
@@ -20,6 +20,7 @@
 #include <IMeshTools_Parameters.hxx>
 #include <IMeshData_Types.hxx>
 #include <IMeshTools_MeshAlgoFactory.hxx>
+#include <NCollection_Array1.hxx>
 
 //! Class implements functionality starting triangulation of model's faces.
 //! Each face is processed separately and can be executed in parallel mode.
@@ -36,12 +37,7 @@ public:
   //! Destructor.
   Standard_EXPORT virtual ~BRepMesh_FaceDiscret();
 
-  //! Functor API to discretize the given edge.
-  inline void operator() (const Standard_Integer theFaceIndex) const {
-    process(theFaceIndex);
-  }
-
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
 
 protected:
 
@@ -55,6 +51,9 @@ private:
   //! Checks existing discretization of the face and updates data model.
   void process(const Standard_Integer theFaceIndex) const;
 
+private:
+  class FaceListFunctor;
+
 private:
 
   Handle(IMeshTools_MeshAlgoFactory) myAlgoFactory;
index 6d69c4bd76b099fca66a980800d705c1e799bf87..c4d6c39d2eeaf0f10ebc2ebb9b9ab5a647f12196 100644 (file)
@@ -99,15 +99,15 @@ public:
   //! @param theIsReplace if TRUE replaces existing point lying within 
   //! parameteric tolerance of the given point.
   //! @return index of new added point or found with parametric tolerance
-  inline Standard_Integer AddPoint(const gp_Pnt&           thePoint,
-                                   const Standard_Real     theParam,
-                                   const Standard_Boolean  theIsReplace = Standard_True)
+  Standard_Integer AddPoint(const gp_Pnt&           thePoint,
+                            const Standard_Real     theParam,
+                            const Standard_Boolean  theIsReplace = Standard_True)
   {
     return myDiscretTool.AddPoint(thePoint, theParam, theIsReplace);
   }
   
   //! Returns number of discretization points.
-  inline Standard_Integer NbPoints() const
+  Standard_Integer NbPoints() const
   {
     return myDiscretTool.NbPoints();
   }
index 24d3fd3658a3ff5b536ad882989a3e7857a8e3cf..b9c62d50195098b35b43d6fd1d2dbf657f583d94 100644 (file)
@@ -22,6 +22,8 @@
 #include <IMeshData_Wire.hxx>
 #include <IMeshTools_MeshBuilder.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot)
+
 namespace
 {
   //! Default flag to control parallelization for BRepMesh_IncrementalMesh
@@ -108,15 +110,18 @@ void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theCont
 
   myStatus = IMeshData_NoError;
   const Handle(IMeshData_Model)& aModel = theContext->GetModel();
-  for (Standard_Integer aFaceIt = 0; aFaceIt < aModel->FacesNb(); ++aFaceIt)
+  if (!aModel.IsNull())
   {
-    const IMeshData::IFaceHandle& aDFace = aModel->GetFace(aFaceIt);
-    myStatus |= aDFace->GetStatusMask();
-
-    for (Standard_Integer aWireIt = 0; aWireIt < aDFace->WiresNb(); ++aWireIt)
+    for (Standard_Integer aFaceIt = 0; aFaceIt < aModel->FacesNb(); ++aFaceIt)
     {
-      const IMeshData::IWireHandle& aDWire = aDFace->GetWire(aWireIt);
-      myStatus |= aDWire->GetStatusMask();
+      const IMeshData::IFaceHandle& aDFace = aModel->GetFace(aFaceIt);
+      myStatus |= aDFace->GetStatusMask();
+
+      for (Standard_Integer aWireIt = 0; aWireIt < aDFace->WiresNb(); ++aWireIt)
+      {
+        const IMeshData::IWireHandle& aDWire = aDFace->GetWire(aWireIt);
+        myStatus |= aDWire->GetStatusMask();
+      }
     }
   }
 
index 4831ffa43463402f80673190b4807ed7f3311386..07be7dbdd16e6abeb3788adf7d859b19c6dbb6ce 100644 (file)
@@ -61,25 +61,25 @@ public: //! @name mesher API
 public: //! @name accessing to parameters.
 
   //! Returns meshing parameters
-  inline const IMeshTools_Parameters& Parameters() const
+  const IMeshTools_Parameters& Parameters() const
   {
     return myParameters;
   }
 
   //! Returns modifiable meshing parameters
-  inline IMeshTools_Parameters& ChangeParameters()
+  IMeshTools_Parameters& ChangeParameters()
   {
     return myParameters;
   }
 
   //! Returns modified flag.
-  inline Standard_Boolean IsModified() const
+  Standard_Boolean IsModified() const
   {
     return myModified;
   }
   
   //! Returns accumulated status flags faced during meshing.
-  inline Standard_Integer GetStatusFlags() const
+  Standard_Integer GetStatusFlags() const
   {
     return myStatus;
   }
@@ -87,7 +87,7 @@ public: //! @name accessing to parameters.
 private:
 
   //! Initializes specific parameters
-  inline void initParameters()
+  void initParameters()
   {
     if (myParameters.DeflectionInterior < Precision::Confusion())
     {
@@ -129,7 +129,7 @@ public: //! @name plugin API
   //! Discret() static method (thus applied only to Mesh Factories).
   Standard_EXPORT static void SetParallelDefault(const Standard_Boolean isInParallel);
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot)
 
 protected:
 
index 891448a1cf12d4b9d817d5e2b27b5903b1f5cad7..e6650d27e9c9bc629092f625a91b666f17c6d465 100644 (file)
@@ -25,6 +25,8 @@
 #include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx>
 #include <BRepMesh_BoundaryParamsRangeSplitter.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory)
+
 namespace
 {
   struct BaseMeshAlgo
index 72a27c55877d25bb6f4d758d734375149ffb46e5..491cb16e83ae83882a0567ca84ccfb59d2ad48e4 100644 (file)
@@ -22,7 +22,7 @@
 #include <IMeshTools_MeshAlgoFactory.hxx>
 
 //! Default implementation of IMeshTools_MeshAlgoFactory providing algorithms 
-//! of different compexity depending on type of target surface.
+//! of different complexity depending on type of target surface.
 class BRepMesh_MeshAlgoFactory : public IMeshTools_MeshAlgoFactory
 {
 public:
@@ -38,7 +38,7 @@ public:
     const GeomAbs_SurfaceType    theSurfaceType,
     const IMeshTools_Parameters& theParameters) const Standard_OVERRIDE;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory)
 };
 
 #endif
\ No newline at end of file
index 31a304f88388ad428e7b2476a2df6cb016dbe6d5..37b32735cbe386bce636db5c4b81d0e2fe5bac2d 100644 (file)
 #include <BRepTools.hxx>
 #include <gp_Pln.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_MeshTool, Standard_Transient)
+
 namespace
 {
   //! Returns index of triangle node opposite to the given link.
-  inline Standard_Integer findApexIndex(
+  Standard_Integer findApexIndex(
     const Standard_Integer(&aNodes)[3],
     const BRepMesh_Edge&   theLink)
   {
index 7ca02940aa7addbb6d7e382527b2183ed6b38882..72c9912ada98def5fac32f4572db0af49a57040a 100644 (file)
@@ -49,7 +49,7 @@ public:
       mySign = myConstraint.Direction().X() > 0;
     }
 
-    inline Standard_Boolean IsAbove(const Standard_Integer theNodeIndex) const
+    Standard_Boolean IsAbove(const Standard_Integer theNodeIndex) const
     {
       const BRepMesh_Vertex& aVertex = myStructure->GetNode(theNodeIndex);
       const gp_Vec2d aNodeVec(myConstraint.Location(), aVertex.Coord());
@@ -88,7 +88,7 @@ public:
   Standard_EXPORT virtual ~BRepMesh_MeshTool();
 
   //! Returns data structure manipulated by this tool.
-  inline const Handle(BRepMesh_DataStructureOfDelaun)& GetStructure() const
+  const Handle(BRepMesh_DataStructureOfDelaun)& GetStructure() const
   {
     return myStructure;
   }
@@ -98,7 +98,7 @@ public:
 
   //! Adds new triangle with specified nodes to mesh.
   //! Legalizes triangle in case if it violates circle criteria.
-  inline void AddAndLegalizeTriangle(
+  void AddAndLegalizeTriangle(
     const Standard_Integer thePoint1,
     const Standard_Integer thePoint2,
     const Standard_Integer thePoint3)
@@ -112,7 +112,7 @@ public:
   }
 
   //! Adds new triangle with specified nodes to mesh.
-  inline void AddTriangle(
+  void AddTriangle(
     const Standard_Integer thePoint1,
     const Standard_Integer thePoint2,
     const Standard_Integer thePoint3,
@@ -128,10 +128,10 @@ public:
 
   //! Adds new link to mesh.
   //! Updates link index and link orientaion parameters.
-  inline void AddLink(const Standard_Integer theFirstNode,
-                      const Standard_Integer theLastNode,
-                      Standard_Integer&      theLinkIndex,
-                      Standard_Boolean&      theLinkOri)
+  void AddLink(const Standard_Integer theFirstNode,
+               const Standard_Integer theLastNode,
+               Standard_Integer&      theLinkIndex,
+               Standard_Boolean&      theLinkOri)
   {
     const Standard_Integer aLinkIt = myStructure->AddLink(
       BRepMesh_Edge(theFirstNode, theLastNode, BRepMesh_Free));
@@ -169,12 +169,12 @@ public:
   //! Gives the list of edges with type defined by input parameter.
   Standard_EXPORT Handle(IMeshData::MapOfInteger) GetEdgesByType(const BRepMesh_DegreeOfFreedom theEdgeType) const;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_MeshTool, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_MeshTool, Standard_Transient)
 
 private:
 
   //! Returns True if the given point lies within circumcircle of the given triangle.
-  inline Standard_Boolean checkCircle(
+  Standard_Boolean checkCircle(
     const Standard_Integer(&aNodes)[3],
     const Standard_Integer thePoint)
   {
@@ -200,7 +200,7 @@ private:
 
   //! Adds new triangle with the given nodes and updates
   //! links stack by ones are not in used map.
-  inline void addTriangleAndUpdateStack(
+  void addTriangleAndUpdateStack(
     const Standard_Integer         theNode0,
     const Standard_Integer         theNode1,
     const Standard_Integer         theNode2,
index 1a15482cdfb2636b6a9c63c7a3d32322a98d634a..79c25f8de9acf5073819be23aef2cee41b741a37 100644 (file)
@@ -22,6 +22,8 @@
 #include <Bnd_Box.hxx>
 #include <BRepBndLib.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index 56898a1eebc90f396e47509a3b1d6e3da3c47532..f88a680829c9b09758ee173e64db22d78ad34a9d 100644 (file)
@@ -36,7 +36,7 @@ public:
   //! Destructor.
   Standard_EXPORT virtual ~BRepMesh_ModelBuilder ();
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder)
 
 protected:
 
index 6ad9b83f566c8f1c33a947452c933a88563b04d8..afe64a14c0eec34685217b0b7f22a39d68e7aef1 100644 (file)
@@ -33,6 +33,8 @@
 #include <TopoDS_Compound.hxx>
 #endif
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelHealer, IMeshTools_ModelAlgo)
+
 namespace
 {
   //! Decreases deflection of the given edge and tries to update discretization.
@@ -73,7 +75,7 @@ namespace
   };
 
   //! Returns True if some of two vertcies is same with reference one.
-  inline Standard_Boolean isSameWithSomeOf(
+  Standard_Boolean isSameWithSomeOf(
     const TopoDS_Vertex& theRefVertex,
     const TopoDS_Vertex& theVertex1,
     const TopoDS_Vertex& theVertex2)
@@ -83,7 +85,7 @@ namespace
   }
 
   //! Returns True if some of two vertcies is within tolerance of reference one.
-  inline Standard_Boolean isInToleranceWithSomeOf(
+  Standard_Boolean isInToleranceWithSomeOf(
     const gp_Pnt& theRefPoint,
     const gp_Pnt& thePoint1,
     const gp_Pnt& thePoint2,
index 2e95c02da448cdb6124ce7ae401cf91e916cc487..68bfd481cc09725bfaec6352b60c3769f1bfed2d 100644 (file)
@@ -45,16 +45,16 @@ public:
   Standard_EXPORT virtual ~BRepMesh_ModelHealer();
 
   //! Functor API to discretize the given edge.
-  inline void operator() (const Standard_Integer theEdgeIndex) const {
+  void operator() (const Standard_Integer theEdgeIndex) const {
     process(theEdgeIndex);
   }
 
   //! Functor API to discretize the given edge.
-  inline void operator() (const IMeshData::IFaceHandle& theDFace) const {
+  void operator() (const IMeshData::IFaceHandle& theDFace) const {
     process(theDFace);
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelHealer, IMeshTools_ModelAlgo)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_ModelHealer, IMeshTools_ModelAlgo)
 
 protected:
 
@@ -66,7 +66,7 @@ protected:
 private:
 
   //! Checks existing discretization of the face and updates data model.
-  inline void process(const Standard_Integer theFaceIndex) const
+  void process(const Standard_Integer theFaceIndex) const
   {
     const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
     process(aDFace);
@@ -95,7 +95,7 @@ private:
   //! Chooses the most closest point to reference one from the given pair.
   //! Returns square distance between reference point and closest one as 
   //! well as pointer to closest point.
-  inline Standard_Real closestPoint(
+  Standard_Real closestPoint(
     gp_Pnt2d&  theRefPnt,
     gp_Pnt2d&  theFristPnt,
     gp_Pnt2d&  theSecondPnt,
@@ -117,7 +117,7 @@ private:
   //! Chooses the most closest points among the given to reference one from the given pair.
   //! Returns square distance between reference point and closest one as 
   //! well as pointer to closest point.
-  inline Standard_Real closestPoints(
+  Standard_Real closestPoints(
     gp_Pnt2d&  theFirstPnt1,
     gp_Pnt2d&  theSecondPnt1,
     gp_Pnt2d&  theFirstPnt2,
@@ -143,7 +143,7 @@ private:
   //! Adjusts the given pair of points supposed to be the same.
   //! In addition, adjusts another end-point of an edge in order
   //! to perform correct matching in case of gap.
-  inline void adjustSamePoints(
+  void adjustSamePoints(
     gp_Pnt2d*& theMajorSamePnt1,
     gp_Pnt2d*& theMinorSamePnt1,
     gp_Pnt2d*& theMajorSamePnt2,
@@ -167,7 +167,7 @@ private:
   void fixFaceBoundaries(const IMeshData::IFaceHandle& theDFace) const;
 
   //! Returns True if check can be done in parallel.
-  inline Standard_Boolean isParallel() const
+  Standard_Boolean isParallel() const
   {
     return (myParameters.InParallel && myModel->FacesNb() > 1);
   }
index 23150517d5ba1d31bc22cc7ddd0a6d2a67177a41..99ccd0d20acbc6b937e66b0a8be30ac711ba2339 100644 (file)
@@ -20,6 +20,8 @@
 #include <IMeshData_PCurve.hxx>
 #include <OSD_Parallel.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
+
 namespace
 {
   //! Commits 3D polygons and polygons on triangulations for corresponding edges.
index 129ba74b9e640fd80a0ba6b89f07f92f62e4fc28..81376067f9143580f518d4b7de1fa5fb83d0e324 100644 (file)
@@ -32,7 +32,7 @@ public:
   //! Destructor.
   Standard_EXPORT virtual ~BRepMesh_ModelPostProcessor();
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
 
 protected:
 
index c9d02d486b3df171f5a715008f3870a72e4ed630..e084f5cf2864cbab16597084f32df352054ecc37 100644 (file)
@@ -14,6 +14,7 @@
 // commercial license or contractual agreement.
 
 #include <BRepMesh_ModelPreProcessor.hxx>
+#include <BRepMesh_Deflection.hxx>
 #include <BRepMesh_ShapeTool.hxx>
 #include <BRep_Tool.hxx>
 #include <IMeshData_Model.hxx>
@@ -23,6 +24,8 @@
 #include <OSD_Parallel.hxx>
 #include <BRepMesh_ConeRangeSplitter.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
+
 namespace
 {
   //! Checks consistency of triangulation stored in topological face.
@@ -30,8 +33,10 @@ namespace
   {
   public:
     //! Constructor
-    TriangulationConsistency(const Handle(IMeshData_Model)& theModel)
+    TriangulationConsistency(const Handle(IMeshData_Model)& theModel,
+                             const Standard_Boolean theAllowQualityDecrease)
       : myModel (theModel)
+      , myAllowQualityDecrease (theAllowQualityDecrease)
     {
     }
 
@@ -51,7 +56,9 @@ namespace
       if (!aTriangulation.IsNull())
       {
         Standard_Boolean isTriangulationConsistent = 
-          aTriangulation->Deflection() < 1.1 * aDFace->GetDeflection();
+          BRepMesh_Deflection::IsConsistent (aTriangulation->Deflection(),
+                                             aDFace->GetDeflection(),
+                                             myAllowQualityDecrease);
 
         if (isTriangulationConsistent)
         {
@@ -88,6 +95,7 @@ namespace
   private:
 
     Handle(IMeshData_Model) myModel;
+    Standard_Boolean myAllowQualityDecrease; //!< Flag used for consistency check
   };
 
   //! Adds additional points to seam edges on specific surfaces.
@@ -251,8 +259,10 @@ Standard_Boolean BRepMesh_ModelPreProcessor::performInternal(
     return Standard_False;
   }
 
-  OSD_Parallel::For(0, theModel->FacesNb(), SeamEdgeAmplifier(theModel, theParameters), !theParameters.InParallel);
-  OSD_Parallel::For(0, theModel->FacesNb(), TriangulationConsistency(theModel),         !theParameters.InParallel);
+  const Standard_Integer aFacesNb    = theModel->FacesNb();
+  const Standard_Boolean isOneThread = !theParameters.InParallel;
+  OSD_Parallel::For(0, aFacesNb, SeamEdgeAmplifier        (theModel, theParameters),                      isOneThread);
+  OSD_Parallel::For(0, aFacesNb, TriangulationConsistency (theModel, theParameters.AllowQualityDecrease), isOneThread);
 
   // Clean edges and faces from outdated polygons.
   Handle(NCollection_IncAllocator) aTmpAlloc(new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE));
index 031053aa38de5b6957e8b7ff669d7b87e3548257..8137cd2e52070de512df6d1fff04cfa006a630d0 100644 (file)
@@ -33,7 +33,7 @@ public:
   //! Destructor.
   Standard_EXPORT virtual ~BRepMesh_ModelPreProcessor();
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
 
 protected:
 
index 332be97de3d575f72c9877574176f45f06e967d4..e64f1980ba03bb2c3709b09f6c38cc9b2c1468b4 100644 (file)
@@ -44,7 +44,10 @@ namespace
         myParamsForbiddenToRemove(theParamsForbiddenToRemove),
         myControlParamsForbiddenToRemove(theControlParamsForbiddenToRemove),
         myAllocator(new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
-        myControlParamsToRemove(new IMeshData::MapOfReal(1, myAllocator))
+        myControlParamsToRemove(new IMeshData::MapOfReal(1, myAllocator)),
+        myCurrParam(0.0),
+        myCurrControlParam(0.0),
+        myPrevControlParam(0.0)
     {
     }
 
@@ -214,7 +217,7 @@ namespace
   };
 
   //! Adds param to map if it fits specified range.
-  inline Standard_Boolean addParam(
+  Standard_Boolean addParam(
     const Standard_Real&                           theParam,
     const std::pair<Standard_Real, Standard_Real>& theRange,
     IMeshData::IMapOfReal&                         theParams)
@@ -230,7 +233,7 @@ namespace
   }
 
   //! Initializes parameters map using CN intervals.
-  inline Standard_Boolean initParamsFromIntervals(
+  Standard_Boolean initParamsFromIntervals(
     const TColStd_Array1OfReal&                    theIntervals,
     const std::pair<Standard_Real, Standard_Real>& theRange,
     const Standard_Boolean                         isSplitIntervals,
@@ -269,11 +272,17 @@ namespace
     for (; aIntervalU <= theIntervals[0].Upper (); ++aIntervalU)
     {
       const Standard_Real aParamU = theIntervals[0].Value(aIntervalU);
+      if (Precision::IsInfinite (aParamU))
+        continue;
+
       Standard_Integer aIntervalV = theIntervals[1].Lower ();
       for (; aIntervalV <= theIntervals[1].Upper (); ++aIntervalV)
       {
         gp_Dir aNorm;
         const Standard_Real aParamV = theIntervals[1].Value(aIntervalV);
+        if (Precision::IsInfinite (aParamV))
+          continue;
+
         if (GeomLib::NormEstim (theSurf, gp_Pnt2d (aParamU, aParamV), Precision::Confusion (), aNorm) != 0)
         {
           return Standard_True;
index a74f2d23a2d275db69183aafeb17af07983c9398..9dfc40973b5f97758456b9d84eac6c9fd9e3b947 100644 (file)
@@ -28,6 +28,7 @@ public:
 
   //! Constructor.
   BRepMesh_NURBSRangeSplitter()
+  : mySurfaceType(GeomAbs_OtherSurface)
   {
   }
 
index 976c1ba4a26bb7cf351334f8d4b11c40ce9e13a0..60007abfb8299f572e0a1487333118d6d6288c15 100644 (file)
@@ -43,13 +43,13 @@ public:
   }
 
   //! Returns index of first node of the Link.
-  inline Standard_Integer FirstNode() const
+  Standard_Integer FirstNode() const
   {
     return myFirstNode;
   }
 
   //! Returns index of last node of the Link.
-  inline Standard_Integer LastNode() const
+  Standard_Integer LastNode() const
   {
     return myLastNode;
   }
@@ -57,7 +57,7 @@ public:
   //! Computes a hash code for this oriented edge, in the range [1, theUpperBound]
   //! @param theUpperBound the upper bound of the range a computing hash code must be within
   //! @return a computed hash code, in the range [1, theUpperBound]
-  inline Standard_Integer HashCode (const Standard_Integer theUpperBound) const
+  Standard_Integer HashCode (const Standard_Integer theUpperBound) const
   {
     return ::HashCode (myFirstNode + myLastNode, theUpperBound);
   }
@@ -65,13 +65,13 @@ public:
   //! Checks this and other edge for equality.
   //! @param theOther edge to be checked against this one.
   //! @retrun TRUE if edges have the same orientation, FALSE if not.
-  inline Standard_Boolean IsEqual(const BRepMesh_OrientedEdge& theOther) const
+  Standard_Boolean IsEqual(const BRepMesh_OrientedEdge& theOther) const
   {
     return (myFirstNode == theOther.myFirstNode && myLastNode == theOther.myLastNode);
   }
 
   //! Alias for IsEqual.
-  inline Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const
+  Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const
   {
     return IsEqual(Other);
   }
index 81808bcf5fd04e15eba7573282741246ad803eea..846b3d4ccefa6533c3410a49d22f45b84d0a0fbc 100644 (file)
@@ -38,7 +38,7 @@ public:
   }
 
   //! Appends index to the pair.
-  inline void Append(const Standard_Integer theIndex)
+  void Append(const Standard_Integer theIndex)
   {
     if (myIndex[0] < 0)
       myIndex[0] = theIndex;
@@ -52,7 +52,7 @@ public:
   }
 
   //! Prepends index to the pair.
-  inline void Prepend(const Standard_Integer theIndex)
+  void Prepend(const Standard_Integer theIndex)
   {
     if (myIndex[1] >= 0)
       throw Standard_OutOfRange("BRepMesh_PairOfIndex::Prepend, more than two index to store");
@@ -62,7 +62,7 @@ public:
   }
 
   //! Returns is pair is empty.
-  inline Standard_Boolean IsEmpty() const
+  Standard_Boolean IsEmpty() const
   {
     // Check only first index. It is impossible to update
     // second index if the first one is empty.
@@ -70,26 +70,26 @@ public:
   }
 
   //! Returns number of initialized indeces.
-  inline Standard_Integer Extent() const
+  Standard_Integer Extent() const
   {
     return (myIndex[0] < 0 ? 0 : (myIndex[1] < 0 ? 1 : 2));
   }
 
   //! Returns first index of pair.
-  inline Standard_Integer FirstIndex() const
+  Standard_Integer FirstIndex() const
   {
     return myIndex[0];
   }
 
   //! Returns last index of pair
-  inline Standard_Integer LastIndex() const
+  Standard_Integer LastIndex() const
   {
     return (myIndex[1] < 0 ? myIndex[0] : myIndex[1]);
   }
 
   //! Returns index corresponding to the given position in the pair.
   //! @param thePairPos position of index in the pair (1 or 2).
-  inline Standard_Integer Index(const Standard_Integer thePairPos) const
+  Standard_Integer Index(const Standard_Integer thePairPos) const
   {
     if (thePairPos != 1 && thePairPos != 2)
       throw Standard_OutOfRange("BRepMesh_PairOfIndex::Index, requested index is out of range");
@@ -100,8 +100,8 @@ public:
   //! Sets index corresponding to the given position in the pair.
   //! @param thePairPos position of index in the pair (1 or 2).
   //! @param theIndex index to be stored.
-  inline void SetIndex(const Standard_Integer thePairPos,
-                       const Standard_Integer theIndex)
+  void SetIndex(const Standard_Integer thePairPos,
+                const Standard_Integer theIndex)
   {
     if (thePairPos != 1 && thePairPos != 2)
       throw Standard_OutOfRange("BRepMesh_PairOfIndex::SetIndex, requested index is out of range");
@@ -111,7 +111,7 @@ public:
 
   //! Remove index from the given position.
   //! @param thePairPos position of index in the pair (1 or 2).
-  inline void RemoveIndex(const Standard_Integer thePairPos)
+  void RemoveIndex(const Standard_Integer thePairPos)
   {
     if (thePairPos != 1 && thePairPos != 2)
       throw Standard_OutOfRange("BRepMesh_PairOfIndex::RemoveIndex, requested index is out of range");
index dd323f29eb0fce7af11a5a44ebb48adc7c3fd64a..0eefc90bc6c764195279b4cd8a77097c8510f2b0 100644 (file)
@@ -18,6 +18,8 @@
 #include <BRepMesh_PairOfIndex.hxx>
 #include <BRepMesh_Edge.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_SelectorOfDataStructureOfDelaun, Standard_Transient)
+
 //=======================================================================
 //function : Default constructor
 //purpose  : 
index 2d1cc4684cda54cc8ba0c82a9b776695956c3bf9..caef4f0cc0eb5d6662d6f3145f15e32817492621 100644 (file)
@@ -60,40 +60,40 @@ public:
   Standard_EXPORT void NeighboursByEdgeOf(const BRepMesh_Triangle& theElement);
   
   //! Adds a level of neighbours by edge to the selector.
-  inline void NeighboursOf(const BRepMesh_SelectorOfDataStructureOfDelaun& /*theSelector*/)
+  void NeighboursOf(const BRepMesh_SelectorOfDataStructureOfDelaun& /*theSelector*/)
   {
   }
   
   //! Adds a level of neighbours by edge the selector.
-  inline void AddNeighbours()
+  void AddNeighbours()
   {
   }
   
   //! Returns selected nodes.
-  inline const IMeshData::MapOfInteger& Nodes() const
+  const IMeshData::MapOfInteger& Nodes() const
   {
     return myNodes;
   }
   
   //! Returns selected links.
-  inline const IMeshData::MapOfInteger& Links() const
+  const IMeshData::MapOfInteger& Links() const
   {
     return myLinks;
   }
   
   //! Returns selected elements.
-  inline const IMeshData::MapOfInteger& Elements() const
+  const IMeshData::MapOfInteger& Elements() const
   {
     return myElements;
   }
   
   //! Gives the list of incices of frontier links.
-  inline const IMeshData::MapOfInteger& FrontierLinks() const
+  const IMeshData::MapOfInteger& FrontierLinks() const
   {
     return myFrontier;
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_SelectorOfDataStructureOfDelaun, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_SelectorOfDataStructureOfDelaun, Standard_Transient)
 
 private:
 
index 83af4d601594cd57149c94dda91b6138fb69e4ab..8189c326841c98176fa1b8d7715fb11ee81088d9 100644 (file)
@@ -26,6 +26,8 @@
 #include <Precision.hxx>
 #include <Bnd_Box.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ShapeTool, Standard_Transient)
+
 namespace
 {
   //! Auxilary struct to take a tolerance of edge.
@@ -72,7 +74,7 @@ Standard_Real BRepMesh_ShapeTool::MaxFaceTolerance(const TopoDS_Face& theFace)
   Standard_Real aMaxTolerance = BRep_Tool::Tolerance(theFace);
 
   Standard_Real aTolerance = Max(
-    MaxTolerance<TopAbs_EDGE, EdgeTolerance  >(theFace),
+    MaxTolerance<TopAbs_EDGE,   EdgeTolerance  >(theFace),
     MaxTolerance<TopAbs_VERTEX, VertexTolerance>(theFace));
 
   return Max(aMaxTolerance, aTolerance);
index d257d612d0aaa448609bd682eeb17e901e96790c..f47ebfba253ad6487f60abbf1dbd1ea99e8607df 100644 (file)
@@ -150,7 +150,7 @@ public:
     Standard_Real&          theLastParam,
     const Standard_Boolean  isConsiderOrientation = Standard_False);
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ShapeTool, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_ShapeTool, Standard_Transient)
 };
 
 #endif
\ No newline at end of file
index 0705c13cf033df8af2b511496a4a276432b38c10..0c4727ab07c7d182da6d924fd71959809cb04a62 100644 (file)
@@ -33,6 +33,8 @@
 #include <IMeshTools_Context.hxx>
 #include <BRepTools.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ShapeVisitor, IMeshTools_ShapeVisitor)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index 171f49c61bd589f75c8caa624cd80c147cbc01f3..9a1e0c0ececf54db264ac6a4f634adad29fae702 100644 (file)
@@ -49,7 +49,7 @@ public:
   //! Handles TopoDS_Edge object.
   Standard_EXPORT virtual void Visit (const TopoDS_Edge& theEdge) Standard_OVERRIDE;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ShapeVisitor, IMeshTools_ShapeVisitor)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_ShapeVisitor, IMeshTools_ShapeVisitor)
 
 private:
 
index c237df213ef8a86cc40bd4253a591ed448c65c31..c1dc41f05953c0f829dd736311b2c98e9b6d41e6 100644 (file)
@@ -42,7 +42,7 @@ public:
 private:
 
   //! Computes step for the given range.
-  inline void computeStep(
+  void computeStep(
     const std::pair<Standard_Real, Standard_Real>& theRange,
     const Standard_Real                            theDefaultStep,
     std::pair<Standard_Real, Standard_Real>&       theStepAndOffset) const
index 6cb531a56bd5355ded9554b6d9ab624355d8607c..72ee6eb6660a76907756c2c41d534ac4852fbefa 100644 (file)
@@ -60,7 +60,7 @@ public:
   //! @param theEdges array of edges of triangle.
   //! @param theOrientations array of edge's orientations.
   //! @param theMovability movability of triangle.
-  inline void Initialize(
+  void Initialize(
     const Standard_Integer          (&theEdges)[3],
     const Standard_Boolean          (&theOrientations)[3],
     const BRepMesh_DegreeOfFreedom  theMovability)
@@ -73,21 +73,21 @@ public:
   //! Gets edges with orientations composing the triangle.
   //! @param[out] theEdges array edges are stored to.
   //! @param[out] theOrientations array orientations are stored to.
-  inline void Edges(Standard_Integer (&theEdges)[3],
-                    Standard_Boolean (&theOrientations)[3]) const
+  void Edges(Standard_Integer (&theEdges)[3],
+             Standard_Boolean (&theOrientations)[3]) const
   {
     memcpy(theEdges, myEdges, sizeof(myEdges));
     memcpy(theOrientations, myOrientations, sizeof(myOrientations));
   }
   
   //! Returns movability of the triangle.
-  inline BRepMesh_DegreeOfFreedom Movability() const 
+  BRepMesh_DegreeOfFreedom Movability() const 
   {
     return myMovability;
   }
   
   //! Sets movability of the triangle.
-  inline void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
+  void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
   {
     myMovability = theMovability;
   }
@@ -95,7 +95,7 @@ public:
   //! Computes a hash code for this triangle, in the range [1, theUpperBound]
   //! @param theUpperBound the upper bound of the range a computing hash code must be within
   //! @return a computed hash code, in the range [1, theUpperBound]
-  inline Standard_Integer HashCode (const Standard_Integer theUpperBound) const
+  Standard_Integer HashCode (const Standard_Integer theUpperBound) const
   {
     return ::HashCode (myEdges[0] + myEdges[1] + myEdges[2], theUpperBound);
   }
@@ -103,7 +103,7 @@ public:
   //! Checks for equality with another triangle.
   //! @param theOther triangle to be checked against this one.
   //! @return TRUE if equal, FALSE if not.
-  inline Standard_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
+  Standard_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
   {
     if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
       return Standard_False;
@@ -133,7 +133,7 @@ public:
   }
   
   //! Alias for IsEqual.
-  inline Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
+  Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
   {
     return IsEqual(theOther);
   }
index f6d2b6223bbe40b85a5ad519d91e3282e3c2cfb9..9538802a61a36468665fa36adfb425f4aee4bc19 100644 (file)
@@ -49,25 +49,25 @@ public:
 
 public:
   //! Returns U parameters.
-  inline const IMeshData::IMapOfReal& GetParametersU() const
+  const IMeshData::IMapOfReal& GetParametersU() const
   {
     return myUParams;
   }
 
   //! Returns U parameters.
-  inline IMeshData::IMapOfReal& GetParametersU()
+  IMeshData::IMapOfReal& GetParametersU()
   {
     return myUParams;
   }
 
   //! Returns V parameters.
-  inline const IMeshData::IMapOfReal& GetParametersV() const
+  const IMeshData::IMapOfReal& GetParametersV() const
   {
     return myVParams;
   }
 
   //! Returns V parameters.
-  inline IMeshData::IMapOfReal& GetParametersV()
+  IMeshData::IMapOfReal& GetParametersV()
   {
     return myVParams;
   }
index 73a31798ea1cbab104b6fea7d64a35fced18b16b..5c6e7cf1026ba3dc78d0c5489dc7e78090d0abe8 100644 (file)
@@ -65,9 +65,9 @@ public:
   //! @param theUV position of vertex in parametric space.
   //! @param theLocation3d index of 3d point to be associated with vertex.
   //! @param theMovability movability of the vertex.
-  inline void Initialize(const gp_XY&                   theUV,
-                         const Standard_Integer         theLocation3d,
-                         const BRepMesh_DegreeOfFreedom theMovability)
+  void Initialize(const gp_XY&                   theUV,
+                  const Standard_Integer         theLocation3d,
+                  const BRepMesh_DegreeOfFreedom theMovability)
   {
     myUV         = theUV;
     myLocation3d = theLocation3d;
@@ -75,31 +75,31 @@ public:
   }
   
   //! Returns position of the vertex in parametric space.
-  inline const gp_XY& Coord() const
+  const gp_XY& Coord() const
   {
     return myUV;
   }
 
   //! Returns position of the vertex in parametric space for modification.
-  inline gp_XY& ChangeCoord()
+  gp_XY& ChangeCoord()
   {
     return myUV;
   }
   
   //! Returns index of 3d point associated with the vertex.
-  inline Standard_Integer Location3d() const
+  Standard_Integer Location3d() const
   {
     return myLocation3d;
   }
   
   //! Returns movability of the vertex.
-  inline BRepMesh_DegreeOfFreedom Movability() const
+  BRepMesh_DegreeOfFreedom Movability() const
   {
     return myMovability;
   }
   
   //! Sets movability of the vertex.
-  inline void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
+  void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
   {
     myMovability = theMovability;
   }
@@ -107,7 +107,7 @@ public:
   //! Computes a hash code for this vertex, in the range [1, theUpperBound]
   //! @param theUpperBound the upper bound of the range a computing hash code must be within
   //! @return a computed hash code, in the range [1, theUpperBound]
-  inline Standard_Integer HashCode(const Standard_Integer theUpperBound) const
+  Standard_Integer HashCode(const Standard_Integer theUpperBound) const
   {
     return ::HashCode(Floor(1e5 * myUV.X()) * Floor(1e5 * myUV.Y()), theUpperBound);
   }
@@ -115,7 +115,7 @@ public:
   //! Checks for equality with another vertex.
   //! @param theOther vertex to be checked against this one.
   //! @return TRUE if equal, FALSE if not.
-  inline Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
+  Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
   {
     if (myMovability          == BRepMesh_Deleted || 
         theOther.myMovability == BRepMesh_Deleted)
@@ -127,7 +127,7 @@ public:
   }
 
   //! Alias for IsEqual.
-  inline Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
+  Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
   {
     return IsEqual(Other);
   }
index dfd51ae926c0f6838a63fdd73ee5cfd9b209dc55..e8efa57dbffd4bc7ec0ab7834014d4dd17ec37b2 100644 (file)
@@ -60,7 +60,7 @@ public:
 
   //! Sets the tolerance to be used for identification of 
   //! coincident vertices equal for both dimensions.
-  inline void SetTolerance(const Standard_Real theTolerance)
+  void SetTolerance(const Standard_Real theTolerance)
   {
     myTolerance[0] = theTolerance * theTolerance;
     myTolerance[1] = 0.;
@@ -70,15 +70,15 @@ public:
   //! coincident vertices.
   //! @param theToleranceX tolerance for X dimension.
   //! @param theToleranceY tolerance for Y dimension.
-  inline void SetTolerance(const Standard_Real theToleranceX,
-                           const Standard_Real theToleranceY)
+  void SetTolerance(const Standard_Real theToleranceX,
+                    const Standard_Real theToleranceY)
   {
     myTolerance[0] = theToleranceX * theToleranceX;
     myTolerance[1] = theToleranceY * theToleranceY;
   }
   
   //! Clear inspector's internal data structures.
-  inline void Clear()
+  void Clear()
   {
     myVertices->Clear();
     myDelNodes.Clear();
@@ -86,26 +86,26 @@ public:
 
   //! Deletes vertex with the given index.
   //! @param theIndex index of vertex to be removed.
-  inline void Delete(const Standard_Integer theIndex)
+  void Delete(const Standard_Integer theIndex)
   {
     myVertices->ChangeValue(theIndex - 1).SetMovability(BRepMesh_Deleted);
     myDelNodes.Append(theIndex);
   }
   
   //! Returns number of registered vertices.
-  inline Standard_Integer NbVertices() const
+  Standard_Integer NbVertices() const
   {
     return myVertices->Length(); 
   }
 
   //! Returns vertex with the given index.
-  inline BRepMesh_Vertex& GetVertex(Standard_Integer theIndex)
+  BRepMesh_Vertex& GetVertex(Standard_Integer theIndex)
   {
     return myVertices->ChangeValue(theIndex - 1);
   }
   
   //! Set reference point to be checked.
-  inline void SetPoint(const gp_XY& thePoint) 
+  void SetPoint(const gp_XY& thePoint) 
   { 
     myIndex     = 0;
     myMinSqDist = RealLast();
@@ -113,26 +113,26 @@ public:
   }
 
   //! Returns index of point coinciding with regerence one.
-  inline Standard_Integer GetCoincidentPoint() const
+  Standard_Integer GetCoincidentPoint() const
   {
     return myIndex;
   }
   
   //! Returns list with indexes of vertices that have movability attribute 
   //! equal to BRepMesh_Deleted and can be replaced with another node.
-  inline const IMeshData::ListOfInteger& GetListOfDelPoints() const
+  const IMeshData::ListOfInteger& GetListOfDelPoints() const
   {
     return myDelNodes;
   }
 
   //! Returns set of mesh vertices.
-  inline const Handle(IMeshData::VectorOfVertex)& Vertices() const
+  const Handle(IMeshData::VectorOfVertex)& Vertices() const
   {
     return myVertices;
   }
 
   //! Returns set of mesh vertices for modification.
-  inline Handle(IMeshData::VectorOfVertex)& ChangeVertices()
+  Handle(IMeshData::VectorOfVertex)& ChangeVertices()
   {
     return myVertices;
   }
index fffa7ac4da535fcc5d435f3fcffe1950f9d8c17b..3393f924970265ade4fb19ee4f9fe5b4524a17b0 100644 (file)
@@ -16,6 +16,8 @@
 #include <BRepMesh_VertexTool.hxx>
 #include <Precision.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_VertexTool, Standard_Transient)
+
 //=======================================================================
 //function : Inspect
 //purpose  : 
index 35aa778a8ac8b1554095ab464e308849ddcdcff4..094021e8e01f9d4d2038c1a88473dbfbeca52032 100644 (file)
@@ -99,19 +99,19 @@ public:
   Standard_EXPORT void DeleteVertex(const Standard_Integer theIndex);
 
   //! Returns set of mesh vertices.
-  inline const Handle(IMeshData::VectorOfVertex)& Vertices() const
+  const Handle(IMeshData::VectorOfVertex)& Vertices() const
   {
     return mySelector.Vertices();
   }
 
   //! Returns set of mesh vertices.
-  inline Handle(IMeshData::VectorOfVertex)& ChangeVertices()
+  Handle(IMeshData::VectorOfVertex)& ChangeVertices()
   {
     return mySelector.ChangeVertices();
   }
 
   //! Returns vertex by the given index.
-  inline const BRepMesh_Vertex& FindKey(const Standard_Integer theIndex)
+  const BRepMesh_Vertex& FindKey(const Standard_Integer theIndex)
   {
     return mySelector.GetVertex(theIndex);
   }
@@ -125,13 +125,13 @@ public:
   }
 
   //! Returns a number of vertices.
-  inline Standard_Integer Extent() const
+  Standard_Integer Extent() const
   {
     return mySelector.NbVertices();
   }
 
   //! Returns True when the map contains no keys. <br>
-  inline Standard_Boolean IsEmpty() const
+  Standard_Boolean IsEmpty() const
   {
     return (Extent() == 0);
   }
@@ -143,14 +143,14 @@ public:
                                   const BRepMesh_Vertex& theVertex);
 
   //! Remove last node from the structure.
-  inline void RemoveLast()
+  void RemoveLast()
   {
     DeleteVertex(Extent());
   }
 
   //! Returns the list with indexes of vertices that have movability attribute
   //! equal to BRepMesh_Deleted and can be replaced with another node.
-  inline const IMeshData::ListOfInteger& GetListOfDelNodes() const
+  const IMeshData::ListOfInteger& GetListOfDelNodes() const
   {
     return mySelector.GetListOfDelPoints();
   }
@@ -158,7 +158,7 @@ public:
   //! Prints statistics.
   Standard_EXPORT void Statistics(Standard_OStream& theStream) const;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMesh_VertexTool, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(BRepMesh_VertexTool, Standard_Transient)
 
 private:
   
@@ -166,9 +166,9 @@ private:
   //! @param thePoint point to be expanded.
   //! @param[out] theMinPoint bottom left corner of area defined by expanded point.
   //! @param[out] theMaxPoint top right corner of area defined by expanded point.
-  inline void expandPoint(const gp_XY& thePoint,
-                          gp_XY&       theMinPoint,
-                          gp_XY&       theMaxPoint)
+  void expandPoint(const gp_XY& thePoint,
+                   gp_XY&       theMinPoint,
+                   gp_XY&       theMaxPoint)
   {
     theMinPoint.SetX(thePoint.X() - myTolerance[0]);
     theMinPoint.SetY(thePoint.Y() - myTolerance[1]);
index a37a4504e43404e644f1bca6f0935dbc2f5f8c42..90df7c410b002b10eb30068ec21942ac43aedef6 100755 (executable)
@@ -1,6 +1,7 @@
 BRepMesh_BaseMeshAlgo.cxx
 BRepMesh_BaseMeshAlgo.hxx
 BRepMesh_ConstrainedBaseMeshAlgo.hxx
+BRepMesh_ConstrainedBaseMeshAlgo.cxx
 BRepMesh_BoundaryParamsRangeSplitter.hxx
 BRepMesh_Circle.hxx
 BRepMesh_CircleInspector.hxx
@@ -85,4 +86,11 @@ BRepMesh_VertexInspector.hxx
 BRepMesh_VertexTool.cxx
 BRepMesh_VertexTool.hxx
 BRepMesh_CustomBaseMeshAlgo.hxx
+BRepMesh_CustomBaseMeshAlgo.cxx
 BRepMesh_CustomDelaunayBaseMeshAlgo.hxx
+delabella.pxx
+delabella.cpp
+BRepMesh_DelabellaBaseMeshAlgo.hxx
+BRepMesh_DelabellaBaseMeshAlgo.cxx
+BRepMesh_DelabellaMeshAlgoFactory.hxx
+BRepMesh_DelabellaMeshAlgoFactory.cxx
diff --git a/src/BRepMesh/delabella.cpp b/src/BRepMesh/delabella.cpp
new file mode 100644 (file)
index 0000000..c6e5260
--- /dev/null
@@ -0,0 +1,1047 @@
+/*
+
+MIT License
+
+DELABELLA - Delaunay triangulation library
+Copyright (C) 2018 GUMIX - Marcin Sokalski
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+*/
+
+#include <assert.h>
+#include <stdio.h>
+
+// gcc 4.9 for Android doesn't have search.h
+#if !defined(__ANDROID__) || defined(__clang__)
+  #include <search.h>
+#endif
+
+#if (defined(__APPLE__))
+#include <malloc/malloc.h>
+#else
+#include <malloc.h>
+#endif
+
+#include <algorithm>
+#include "delabella.pxx" // we just need LOG() macro
+
+// assuming BITS is max(X_BITS,Y_BITS)
+
+typedef double Signed14;               // BITS                 xy coords
+typedef double Signed15;               // BITS + 1             vect::xy
+typedef long double Unsigned28; // 2xBITS              z coord
+typedef long double Signed29;   // 2xBITS + 1  vect::z
+typedef long double Signed31;   // 2xBITS + 3  norm::z
+typedef long double Signed45;   // 3xBITS + 3  norm::xy
+typedef long double Signed62;   // 4xBITS + 6  dot(vect,norm)
+
+/*
+// above typedefs can be used to configure delabella arithmetic types
+// in example, EXACT SOLVER (with xy coords limited to 14bits integers in range: +/-8192) 
+// could be achieved with following configuration:
+
+typedef int16_t  Signed14;             // BITS                 xy coords
+typedef int16_t  Signed15;             // BITS + 1             vect::xy
+typedef uint32_t Unsigned28;   // 2xBITS               z coord
+typedef int32_t  Signed29;             // 2xBITS + 1   vect::z
+typedef int32_t  Signed31;             // 2xBITS + 3   norm::z
+typedef int64_t  Signed45;             // 3xBITS + 3   norm::xy
+typedef int64_t  Signed62;             // 4xBITS + 6   dot(vect,norm)
+
+// alternatively, one could use some BigInt implementation
+// in order to expand xy range
+*/
+
+
+static Unsigned28 s14sqr(const Signed14& s)
+{
+       return (Unsigned28)((Signed29)s*s);
+}
+
+struct Norm
+{
+       Signed45 x;
+       Signed45 y;
+       Signed31 z;
+};
+
+struct Vect
+{
+       Signed15 x, y;
+       Signed29 z;
+
+       Norm cross (const Vect& v) const // cross prod
+       {
+               Norm n;
+               n.x = (Signed45)y*v.z - (Signed45)z*v.y;
+               n.y = (Signed45)z*v.x - (Signed45)x*v.z;
+               n.z = (Signed29)x*v.y - (Signed29)y*v.x;
+               return n;
+       }
+};
+
+struct CDelaBella : IDelaBella
+{
+       struct Face;
+
+       struct Vert : DelaBella_Vertex
+       {
+               Unsigned28 z;
+               Face* sew;
+
+               Vect operator - (const Vert& v) const // diff
+               {
+                       Vect d;
+                       d.x = (Signed15)x - (Signed15)v.x;
+                       d.y = (Signed15)y - (Signed15)v.y;
+                       d.z = (Signed29)z - (Signed29)v.z;
+                       return d;
+               }
+
+               static bool overlap(const Vert* v1, const Vert* v2)
+               {
+                       return v1->x == v2->x && v1->y == v2->y;
+               }
+
+               bool operator < (const Vert& v) const
+               {
+                       return u28cmp(this, &v) < 0;
+               }
+
+               static int u28cmp(const void* a, const void* b)
+               {
+                       Vert* va = (Vert*)a;
+                       Vert* vb = (Vert*)b;
+                       if (va->z < vb->z)
+                               return -1;
+                       if (va->z > vb->z)
+                               return 1;
+                       if (va->y < vb->y)
+                               return -1;
+                       if (va->y > vb->y)
+                               return 1;
+                       if (va->x < vb->x)
+                               return -1;
+                       if (va->x > vb->x)
+                               return 1;
+                       if (va->i < vb->i)
+                               return -1;
+                       if (va->i > vb->i)
+                               return 1;
+                       return 0;
+               }
+       };
+
+       struct Face : DelaBella_Triangle
+       {
+               Norm n;
+
+               static Face* Alloc(Face** from)
+               {
+                       Face* f = *from;
+                       *from = (Face*)f->next;
+                       f->next = 0;
+                       return f;
+               }
+
+               void Free(Face** to)
+               {
+                       next = *to;
+                       *to = this;
+               }
+
+               Face* Next(const Vert* p) const
+               {
+                       // return next face in same direction as face vertices are (cw/ccw)
+
+                       if (v[0] == p)
+                               return (Face*)f[1];
+                       if (v[1] == p)
+                               return (Face*)f[2];
+                       if (v[2] == p)
+                               return (Face*)f[0];
+                       return 0;
+               }
+
+               Signed62 dot(const Vert& p) const // dot
+               {
+                       Vect d = p - *(Vert*)v[0];
+                       return (Signed62)n.x * d.x + (Signed62)n.y * d.y + (Signed62)n.z * d.z;
+               }
+
+               Norm cross() const // cross of diffs
+               {
+                       return (*(Vert*)v[1] - *(Vert*)v[0]).cross(*(Vert*)v[2] - *(Vert*)v[0]);
+               }
+       };
+
+       Vert* vert_alloc;
+       Face* face_alloc;
+       int max_verts;
+       int max_faces;
+
+       Face* first_dela_face;
+       Face* first_hull_face;
+       Vert* first_hull_vert;
+
+       int inp_verts;
+       int out_verts;
+
+       int(*errlog_proc)(void* file, const char* fmt, ...);
+       void* errlog_file;
+
+       virtual ~CDelaBella ()
+       {
+       }
+
+       int Triangulate()
+       {
+               int points = inp_verts;
+               std::sort(vert_alloc, vert_alloc + points);
+
+               // rmove dups
+               {
+                       int w = 0, r = 1; // skip initial no-dups block
+                       while (r < points && !Vert::overlap(vert_alloc + r, vert_alloc + w))
+                       {
+                               w++;
+                               r++;
+                       }
+
+                       w++;
+
+                       while (r < points)
+                       {
+                               r++;
+
+                               // skip dups
+                               while (r < points && Vert::overlap(vert_alloc + r, vert_alloc + r - 1))
+                                       r++;
+
+                               // copy next no-dups block
+                               while (r < points && !Vert::overlap(vert_alloc + r, vert_alloc + r - 1))
+                                       vert_alloc[w++] = vert_alloc[r++];
+                       }
+
+                       if (points - w)
+                       {
+                               if (errlog_proc)
+                                       errlog_proc(errlog_file, "[WRN] detected %d dups in xy array!\n", points - w);
+                               points = w;
+                       }
+               }
+
+               if (points < 3)
+               {
+                       if (points == 2)
+                       {
+                               if (errlog_proc)
+                                       errlog_proc(errlog_file, "[WRN] all input points are colinear, returning single segment!\n");
+                               first_hull_vert = vert_alloc + 0;
+                               vert_alloc[0].next = (DelaBella_Vertex*)vert_alloc + 1;
+                               vert_alloc[1].next = 0;
+                       }
+                       else
+                       {
+                               if (errlog_proc)
+                                       errlog_proc(errlog_file, "[WRN] all input points are identical, returning signle point!\n");
+                               first_hull_vert = vert_alloc + 0;
+                               vert_alloc[0].next = 0;
+                       }
+
+                       return -points;
+               }
+
+               int hull_faces = 2 * points - 4;
+
+               if (max_faces < hull_faces)
+               {
+                       if (max_faces)
+                               free(face_alloc);
+                       max_faces = 0;
+                       face_alloc = (Face*)malloc(sizeof(Face) * hull_faces);
+                       if (face_alloc)
+                               max_faces = hull_faces;
+                       else
+                       {
+                               if (errlog_proc)
+                                       errlog_proc(errlog_file, "[ERR] Not enough memory, shop for some more RAM. See you!\n");
+                               return 0;
+                       }
+               }
+
+               for (int i = 1; i < hull_faces; i++)
+                       face_alloc[i - 1].next = face_alloc + i;
+               face_alloc[hull_faces - 1].next = 0;
+
+               Face* cache = face_alloc;
+               Face* hull = 0;
+
+               Face f; // tmp
+               f.v[0] = vert_alloc + 0;
+               f.v[1] = vert_alloc + 1;
+               f.v[2] = vert_alloc + 2;
+               f.n = f.cross();
+
+               bool colinear = f.n.z == 0;
+               int i = 3;
+
+               /////////////////////////////////////////////////////////////////////////
+               // UNTIL INPUT IS COPLANAR, GROW IT IN FORM OF A 2D CONTOUR
+               /*
+               . |                |         after adding     . |        ________* L
+               . \ Last points to / Head     next point      . \ ______/        /
+               .  *____          |             ----->        .H *____          |
+               .  |\_  \_____    |                           .  |\_  \_____    |
+               .   \ \_      \__* - Tail points to Last      .   \ \_      \__* T
+               .    \  \_      /                             .    \  \_      /
+               .     \__ \_ __/                              .     \__ \_ __/
+               .        \__* - Head points to Tail           .        \__/
+               */
+
+               Vert* head = (Vert*)f.v[0];
+               Vert* tail = (Vert*)f.v[1];
+               Vert* last = (Vert*)f.v[2];
+
+               head->next = tail;
+               tail->next = last;
+               last->next = head;
+
+               while (i < points && f.dot(vert_alloc[i]) == 0)
+               {
+                       Vert* v = vert_alloc + i;
+
+                       // it is enough to test just 1 non-zero coord
+                       // but we want also to test stability (assert) 
+                       // so we calc all signs...
+
+                       // why not testing sign of dot prod of 2 normals?
+                       // that way we'd fall into precission problems
+
+                       Norm LvH = (*v - *last).cross(*head - *last);
+                       bool lvh =
+                               (f.n.x > 0 && LvH.x > 0) || (f.n.x < 0 && LvH.x < 0) ||
+                               (f.n.y > 0 && LvH.y > 0) || (f.n.y < 0 && LvH.y < 0) ||
+                               (f.n.z > 0 && LvH.z > 0) || (f.n.z < 0 && LvH.z < 0);
+
+                       Norm TvL = (*v - *tail).cross(*last - *tail);
+                       bool tvl =
+                               (f.n.x > 0 && TvL.x > 0) || (f.n.x < 0 && TvL.x < 0) ||
+                               (f.n.y > 0 && TvL.y > 0) || (f.n.y < 0 && TvL.y < 0) ||
+                               (f.n.z > 0 && TvL.z > 0) || (f.n.z < 0 && TvL.z < 0);
+
+                       if (lvh && !tvl) // insert new f on top of e(2,0) = (last,head)
+                       {
+                               // f.v[0] = head;
+                               f.v[1] = last;
+                               f.v[2] = v;
+
+                               last->next = v;
+                               v->next = head;
+                               tail = last;
+                       }
+                       else
+                               if (tvl && !lvh) // insert new f on top of e(1,2) = (tail,last)
+                               {
+                                       f.v[0] = last;
+                                       //f.v[1] = tail;
+                                       f.v[2] = v;
+
+                                       tail->next = v;
+                                       v->next = last;
+                                       head = last;
+                               }
+                               else
+                               {
+                                       // wtf? dilithium crystals are fucked.
+                                       assert(0);
+                               }
+
+                       last = v;
+                       i++;
+               }
+
+               if (i == points)
+               {
+                       if (colinear)
+                       {
+                               if (errlog_proc)
+                                       errlog_proc(errlog_file, "[WRN] all input points are colinear, returning segment list!\n");
+                               first_hull_vert = head;
+                               last->next = 0; // break contour, make it a list 
+                               return -points;
+                       }
+                       else
+                       {
+                               if (points > 3)
+                               {
+                                       if (errlog_proc)
+                                               errlog_proc(errlog_file, "[NFO] all input points are cocircular.\n");
+                               }
+                               else
+                               {
+                                       if (errlog_proc)
+                                               errlog_proc(errlog_file, "[NFO] trivial case of 3 points, thank you.\n");
+
+                                       first_dela_face = Face::Alloc(&cache);
+                                       first_dela_face->next = 0;
+                                       first_hull_face = Face::Alloc(&cache);
+                                       first_hull_face->next = 0;
+
+                                       first_dela_face->f[0] = first_dela_face->f[1] = first_dela_face->f[2] = first_hull_face;
+                                       first_hull_face->f[0] = first_hull_face->f[1] = first_hull_face->f[2] = first_dela_face;
+
+                                       head->sew = tail->sew = last->sew = first_hull_face;
+
+                                       if (f.n.z < 0)
+                                       {
+                                               first_dela_face->v[0] = head;
+                                               first_dela_face->v[1] = tail;
+                                               first_dela_face->v[2] = last;
+                                               first_hull_face->v[0] = last;
+                                               first_hull_face->v[1] = tail;
+                                               first_hull_face->v[2] = head;
+
+                                               // reverse silhouette
+                                               head->next = last;
+                                               last->next = tail;
+                                               tail->next = head;
+
+                                               first_hull_vert = last;
+                                       }
+                                       else
+                                       {
+                                               first_dela_face->v[0] = last;
+                                               first_dela_face->v[1] = tail;
+                                               first_dela_face->v[2] = head;
+                                               first_hull_face->v[0] = head;
+                                               first_hull_face->v[1] = tail;
+                                               first_hull_face->v[2] = last;
+
+                                               first_hull_vert = head;
+                                       }
+
+                                       first_dela_face->n = first_dela_face->cross();
+                                       first_hull_face->n = first_hull_face->cross();
+
+                                       return 3;
+                               }
+
+                               // retract last point it will be added as a cone's top later
+                               last = head;
+                               head = (Vert*)head->next;
+                               i--;
+                       }
+               }
+
+               /////////////////////////////////////////////////////////////////////////
+               // CREATE CONE HULL WITH TOP AT cloud[i] AND BASE MADE OF CONTOUR LIST
+               // in 2 ways :( - depending on at which side of the contour a top vertex appears
+
+               Vert* q = vert_alloc + i;
+
+               if (f.dot(*q) > 0)
+               {
+                       Vert* p = last;
+                       Vert* n = (Vert*)p->next;
+
+                       Face* first_side = Face::Alloc(&cache);
+                       first_side->v[0] = p;
+                       first_side->v[1] = n;
+                       first_side->v[2] = q;
+                       first_side->n = first_side->cross();
+                       hull = first_side;
+
+                       p = n;
+                       n = (Vert*)n->next;
+
+                       Face* prev_side = first_side;
+                       Face* prev_base = 0;
+                       Face* first_base = 0;
+
+                       do
+                       {
+                               Face* base = Face::Alloc(&cache);
+                               base->v[0] = n;
+                               base->v[1] = p;
+                               base->v[2] = last;
+                               base->n = base->cross();
+
+                               Face* side = Face::Alloc(&cache);
+                               side->v[0] = p;
+                               side->v[1] = n;
+                               side->v[2] = q;
+                               side->n = side->cross();
+
+                               side->f[2] = base;
+                               base->f[2] = side;
+
+                               side->f[1] = prev_side;
+                               prev_side->f[0] = side;
+
+                               base->f[0] = prev_base;
+                               if (prev_base)
+                                       prev_base->f[1] = base;
+                               else
+                                       first_base = base;
+
+                               prev_base = base;
+                               prev_side = side;
+
+                               p = n;
+                               n = (Vert*)n->next;
+                       } while (n != last);
+
+                       Face* last_side = Face::Alloc(&cache);
+                       last_side->v[0] = p;
+                       last_side->v[1] = n;
+                       last_side->v[2] = q;
+                       last_side->n = last_side->cross();
+
+                       last_side->f[1] = prev_side;
+                       prev_side->f[0] = last_side;
+
+                       last_side->f[0] = first_side;
+                       first_side->f[1] = last_side;
+
+                       first_base->f[0] = first_side;
+                       first_side->f[2] = first_base;
+
+                       last_side->f[2] = prev_base;
+                       prev_base->f[1] = last_side;
+
+                       i++;
+               }
+               else
+               {
+                       Vert* p = last;
+                       Vert* n = (Vert*)p->next;
+
+                       Face* first_side = Face::Alloc(&cache);
+                       first_side->v[0] = n;
+                       first_side->v[1] = p;
+                       first_side->v[2] = q;
+                       first_side->n = first_side->cross();
+                       hull = first_side;
+
+                       p = n;
+                       n = (Vert*)n->next;
+
+                       Face* prev_side = first_side;
+                       Face* prev_base = 0;
+                       Face* first_base = 0;
+
+                       do
+                       {
+                               Face* base = Face::Alloc(&cache);
+                               base->v[0] = p;
+                               base->v[1] = n;
+                               base->v[2] = last;
+                               base->n = base->cross();
+
+                               Face* side = Face::Alloc(&cache);
+                               side->v[0] = n;
+                               side->v[1] = p;
+                               side->v[2] = q;
+                               side->n = side->cross();
+
+                               side->f[2] = base;
+                               base->f[2] = side;
+
+                               side->f[0] = prev_side;
+                               prev_side->f[1] = side;
+
+                               base->f[1] = prev_base;
+                               if (prev_base)
+                                       prev_base->f[0] = base;
+                               else
+                                       first_base = base;
+
+                               prev_base = base;
+                               prev_side = side;
+
+                               p = n;
+                               n = (Vert*)n->next;
+                       } while (n != last);
+
+                       Face* last_side = Face::Alloc(&cache);
+                       last_side->v[0] = n;
+                       last_side->v[1] = p;
+                       last_side->v[2] = q;
+                       last_side->n = last_side->cross();
+
+                       last_side->f[0] = prev_side;
+                       prev_side->f[1] = last_side;
+
+                       last_side->f[1] = first_side;
+                       first_side->f[0] = last_side;
+
+                       first_base->f[1] = first_side;
+                       first_side->f[2] = first_base;
+
+                       last_side->f[2] = prev_base;
+                       prev_base->f[0] = last_side;
+
+                       i++;
+               }
+
+               /////////////////////////////////////////////////////////////////////////
+               // ACTUAL ALGORITHM
+
+               for (; i < points; i++)
+               {
+                       //ValidateHull(alloc, 2 * i - 4);
+
+                       Vert* _q = vert_alloc + i;
+                       Vert* _p = vert_alloc + i - 1;
+                       Face* _f = hull;
+
+                       // 1. FIND FIRST VISIBLE FACE 
+                       //    simply iterate around last vertex using last added triange adjecency info
+                       while (_f->dot(*_q) <= 0)
+                       {
+                               _f = _f->Next(_p);
+                               if (_f == hull)
+                               {
+                                       // if no visible face can be located at last vertex,
+                                       // let's run through all faces (approximately last to first), 
+                                       // yes this is emergency fallback and should not ever happen.
+                                       _f = face_alloc + 2 * i - 4 - 1;
+                                       while (_f->dot(*_q) <= 0)
+                                       {
+                                               assert(_f != face_alloc); // no face is visible? you must be kidding!
+                                               _f--;
+                                       }
+                               }
+                       }
+
+                       // 2. DELETE VISIBLE FACES & ADD NEW ONES
+                       //    (we also build silhouette (vertex loop) between visible & invisible faces)
+
+                       int del = 0;
+                       int add = 0;
+
+                       // push first visible face onto stack (of visible faces)
+                       Face* stack = _f;
+                       _f->next = _f; // old trick to use list pointers as 'on-stack' markers
+                       while (stack)
+                       {
+                               // pop, take care of last item ptr (it's not null!)
+                               _f = stack;
+                               stack = (Face*)_f->next;
+                               if (stack == _f)
+                                       stack = 0;
+                               _f->next = 0;
+
+                               // copy parts of old face that we still need after removal
+                               Vert* fv[3] = { (Vert*)_f->v[0],(Vert*)_f->v[1],(Vert*)_f->v[2] };
+                               Face* ff[3] = { (Face*)_f->f[0],(Face*)_f->f[1],(Face*)_f->f[2] };
+
+                               // delete visible face
+                               _f->Free(&cache);
+                               del++;
+
+                               // check all 3 neighbors
+                               for (int e = 0; e < 3; e++)
+                               {
+                                       Face* n = ff[e];
+                                       if (n && !n->next) // ensure neighbor is not processed yet & isn't on stack 
+                                       {
+                                               if (n->dot(*_q) <= 0) // if neighbor is not visible we have slihouette edge
+                                               {
+                                                       // build face
+                                                       add++;
+
+                                                       // ab: given face adjacency [index][], 
+                                                       // it provides [][2] vertex indices on shared edge (CCW order)
+                                                       const static int ab[3][2] = { { 1,2 },{ 2,0 },{ 0,1 } };
+
+                                                       Vert* a = fv[ab[e][0]];
+                                                       Vert* b = fv[ab[e][1]];
+
+                                                       Face* s = Face::Alloc(&cache);
+                                                       s->v[0] = a;
+                                                       s->v[1] = b;
+                                                       s->v[2] = _q;
+
+                                                       s->n = s->cross();
+                                                       s->f[2] = n;
+
+                                                       // change neighbour's adjacency from old visible face to cone side
+                                                       if (n->f[0] == _f)
+                                                               n->f[0] = s;
+                                                       else
+                                                               if (n->f[1] == _f)
+                                                                       n->f[1] = s;
+                                                               else
+                                                                       if (n->f[2] == _f)
+                                                                               n->f[2] = s;
+                                                                       else
+                                                                               assert(0);
+
+                                                       // build silhouette needed for sewing sides in the second pass
+                                                       a->sew = s;
+                                                       a->next = b;
+                                               }
+                                               else
+                                               {
+                                                       // disjoin visible faces
+                                                       // so they won't be processed more than once
+
+                                                       if (n->f[0] == _f)
+                                                               n->f[0] = 0;
+                                                       else
+                                                               if (n->f[1] == _f)
+                                                                       n->f[1] = 0;
+                                                               else
+                                                                       if (n->f[2] == _f)
+                                                                               n->f[2] = 0;
+                                                                       else
+                                                                               assert(0);
+
+                                                       // push neighbor face, it's visible and requires processing
+                                                       n->next = stack ? stack : n;
+                                                       stack = n;
+                                               }
+                                       }
+                               }
+                       }
+
+                       // if add<del+2 hungry hull has consumed some point
+                       // that means we can't do delaunay for some under precission reasons
+                       // althought convex hull would be fine with it
+                       assert(add == del + 2);
+
+                       // 3. SEW SIDES OF CONE BUILT ON SLIHOUTTE SEGMENTS
+
+                       hull = face_alloc + 2 * i - 4 + 1; // last added face
+
+                                                                                 // last face must contain part of the silhouette
+                                                                                 // (edge between its v[0] and v[1])
+                       Vert* entry = (Vert*)hull->v[0];
+
+                       Vert* pr = entry;
+                       do
+                       {
+                               // sew pr<->nx
+                               Vert* nx = (Vert*)pr->next;
+                               pr->sew->f[0] = nx->sew;
+                               nx->sew->f[1] = pr->sew;
+                               pr = nx;
+                       } while (pr != entry);
+               }
+
+               assert(2 * i - 4 == hull_faces);
+               //ValidateHull(alloc, hull_faces);
+
+               // needed?
+               for (i = 0; i < points; i++)
+               {
+                       vert_alloc[i].next = 0;
+                       vert_alloc[i].sew = 0;
+               }
+
+               i = 0;
+               Face** prev_dela = &first_dela_face;
+               Face** prev_hull = &first_hull_face;
+               for (int j = 0; j < hull_faces; j++)
+               {
+                       Face* _f = face_alloc + j;
+                       if (_f->n.z < 0)
+                       {
+                               *prev_dela = _f;
+                               prev_dela = (Face**)&_f->next;
+                               i++;
+                       }
+                       else
+                       {
+                               *prev_hull = _f;
+                               prev_hull = (Face**)&_f->next;
+                               if (((Face*)_f->f[0])->n.z < 0)
+                               {
+                                       _f->v[1]->next = _f->v[2];
+                                       ((Vert*)_f->v[1])->sew = _f;
+                               }
+                               if (((Face*)_f->f[1])->n.z < 0)
+                               {
+                                       _f->v[2]->next = _f->v[0];
+                                       ((Vert*)_f->v[2])->sew = _f;
+                               }
+                               if (((Face*)_f->f[2])->n.z < 0)
+                               {
+                                       _f->v[0]->next = _f->v[1];
+                                       ((Vert*)_f->v[0])->sew = _f;
+                               }
+                       }
+               }
+
+               *prev_dela = 0;
+               *prev_hull = 0;
+
+               first_hull_vert = (Vert*)first_hull_face->v[0];
+
+               // todo link slihouette verts into contour
+               // and sew its edges with hull faces
+
+               return 3*i;
+       }
+
+       bool ReallocVerts(int points)
+       {
+               inp_verts = points;
+               out_verts = 0;
+
+               first_dela_face = 0;
+               first_hull_face = 0;
+               first_hull_vert = 0;
+
+               if (max_verts < points)
+               {
+                       if (max_verts)
+                       {
+                               free(vert_alloc);
+                               vert_alloc = 0;
+                               max_verts = 0;
+                       }
+
+                       vert_alloc = (Vert*)malloc(sizeof(Vert)*points);
+                       if (vert_alloc)
+                               max_verts = points;
+                       else
+                       {
+                               if (errlog_proc)
+                                       errlog_proc(errlog_file, "[ERR] Not enough memory, shop for some more RAM. See you!\n");
+                               return false;
+                       }
+               }
+
+               return true;
+       }
+
+       virtual int Triangulate(int points, const float* x, const float* y = 0, int advance_bytes = 0)
+       {
+               if (!x)
+                       return 0;
+
+               if (!y)
+                       y = x + 1;
+
+               if (advance_bytes < static_cast<int>(sizeof(float) * 2))
+                       advance_bytes = static_cast<int>(sizeof(float) * 2);
+
+               if (!ReallocVerts(points))
+                       return 0;
+
+               for (int i = 0; i < points; i++)
+               {
+                       Vert* v = vert_alloc + i;
+                       v->i = i;
+                       v->x = (Signed14)*(const float*)((const char*)x + i*advance_bytes);
+                       v->y = (Signed14)*(const float*)((const char*)y + i*advance_bytes);
+                       v->z = s14sqr(v->x) + s14sqr(v->y);
+               }
+
+               out_verts = Triangulate();
+               return out_verts;
+       }
+
+       virtual int Triangulate(int points, const double* x, const double* y, int advance_bytes)
+       {
+               if (!x)
+                       return 0;
+               
+               if (!y)
+                       y = x + 1;
+               
+               if (advance_bytes < static_cast<int>(sizeof(double) * 2))
+                       advance_bytes = static_cast<int>(sizeof(double) * 2);
+
+               if (!ReallocVerts(points))
+                       return 0;
+
+               for (int i = 0; i < points; i++)
+               {
+                       Vert* v = vert_alloc + i;
+                       v->i = i;
+                       v->x = (Signed14)*(const double*)((const char*)x + i*advance_bytes);
+                       v->y = (Signed14)*(const double*)((const char*)y + i*advance_bytes);
+                       v->z = s14sqr (v->x) + s14sqr (v->y);
+               }
+
+               out_verts = Triangulate();
+               return out_verts;
+       }
+
+       virtual void Destroy()
+       {
+               if (face_alloc)
+                       free(face_alloc);
+               if (vert_alloc)
+                       free(vert_alloc);
+               delete this;
+       }
+
+       // num of points passed to last call to Triangulate()
+       virtual int GetNumInputPoints() const
+       {
+               return inp_verts;
+       }
+
+       // num of verts returned from last call to Triangulate()
+       virtual int GetNumOutputVerts() const
+       {
+               return out_verts;
+       }
+
+       virtual const DelaBella_Triangle* GetFirstDelaunayTriangle() const
+       {
+               return first_dela_face;
+       }
+
+       virtual const DelaBella_Triangle* GetFirstHullTriangle() const
+       {
+               return first_hull_face;
+       }
+
+       virtual const DelaBella_Vertex* GetFirstHullVertex() const
+       {
+               return first_hull_vert;
+       }
+
+       virtual void SetErrLog(int(*proc)(void* stream, const char* fmt, ...), void* stream)
+       {
+               errlog_proc = proc;
+               errlog_file = stream;
+       }
+};
+
+IDelaBella* IDelaBella::Create()
+{
+       CDelaBella* db = new CDelaBella;
+       if (!db)
+               return 0;
+
+       db->vert_alloc = 0;
+       db->face_alloc = 0;
+       db->max_verts = 0;
+       db->max_faces = 0;
+
+       db->first_dela_face = 0;
+       db->first_hull_face = 0;
+       db->first_hull_vert = 0;
+
+       db->inp_verts = 0;
+       db->out_verts = 0;
+
+       db->errlog_proc = 0;
+       db->errlog_file = 0;
+
+       return db;
+}
+
+void* DelaBella_Create()
+{
+       return IDelaBella::Create();
+}
+
+void  DelaBella_Destroy(void* db)
+{
+       ((IDelaBella*)db)->Destroy();
+}
+
+void  DelaBella_SetErrLog(void* db, int(*proc)(void* stream, const char* fmt, ...), void* stream)
+{
+       ((IDelaBella*)db)->SetErrLog(proc, stream);
+}
+
+int   DelaBella_TriangulateFloat(void* db, int points, float* x, float* y, int advance_bytes)
+{
+       return ((IDelaBella*)db)->Triangulate(points, x, y, advance_bytes);
+}
+
+int   DelaBella_TriangulateDouble(void* db, int points, double* x, double* y, int advance_bytes)
+{
+       return ((IDelaBella*)db)->Triangulate(points, x, y, advance_bytes);
+}
+
+int   DelaBella_GetNumInputPoints(void* db)
+{
+       return ((IDelaBella*)db)->GetNumInputPoints();
+}
+
+int   DelaBella_GetNumOutputVerts(void* db)
+{
+       return ((IDelaBella*)db)->GetNumOutputVerts();
+}
+
+const DelaBella_Triangle* GetFirstDelaunayTriangle(void* db)
+{
+       return ((IDelaBella*)db)->GetFirstDelaunayTriangle();
+}
+
+const DelaBella_Triangle* GetFirstHullTriangle(void* db)
+{
+       return ((IDelaBella*)db)->GetFirstHullTriangle();
+}
+
+const DelaBella_Vertex*   GetFirstHullVertex(void* db)
+{
+       return ((IDelaBella*)db)->GetFirstHullVertex();
+}
+
+// depreciated!
+int DelaBella(int points, const double* xy, int* abc, int(*errlog)(const char* fmt, ...))
+{
+       if (errlog)
+               errlog("[WRN] Depreciated interface! errlog disabled.\n");
+
+       if (!xy || points <= 0)
+               return 0;
+
+       IDelaBella* db = IDelaBella::Create();
+       int verts = db->Triangulate(points, xy, 0, 0);
+
+       if (!abc)
+               return verts;
+
+       if (verts > 0)
+       {
+               int tris = verts / 3;
+               const DelaBella_Triangle* dela = db->GetFirstDelaunayTriangle();
+               for (int i = 0; i < tris; i++)
+               {
+                       for (int j=0; j<3; j++)
+                               abc[3 * i + j] = dela->v[j]->i;
+                       dela = dela->next;
+               }
+       }
+       else
+       {
+               int pnts = -verts;
+               const DelaBella_Vertex* line = db->GetFirstHullVertex();
+               for (int i = 0; i < pnts; i++)
+               {
+                       abc[i] = line->i;
+                       line = line->next;
+               }
+       }
+
+       return verts;
+}
diff --git a/src/BRepMesh/delabella.pxx b/src/BRepMesh/delabella.pxx
new file mode 100644 (file)
index 0000000..a7ff00b
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+
+MIT License
+
+DELABELLA - Delaunay triangulation library
+Copyright (C) 2018 GUMIX - Marcin Sokalski
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+*/
+
+#ifndef DELABELLA_H
+#define DELABELLA_H
+
+// returns: positive value: number of triangle indices, negative: number of line segment indices (degenerated input)
+//          triangle indices in abc array are always returned in clockwise order
+// DEPRECIATED. move to new API either extern "C" or IDelaBella (C++)
+int DelaBella(int points, const double* xy/*[points][2]*/, int* abc/*[2*points-5][3]*/, int (*errlog)(const char* fmt,...) = printf);
+
+struct DelaBella_Vertex
+{
+       int i; // index of original point
+       double x, y; // coordinates (input copy)
+       DelaBella_Vertex* next; // next silhouette vertex
+};
+
+struct DelaBella_Triangle
+{
+       DelaBella_Vertex* v[3]; // 3 vertices spanning this triangle
+       DelaBella_Triangle* f[3]; // 3 adjacent faces, f[i] is at the edge opposite to vertex v[i]
+       DelaBella_Triangle* next; // next triangle (of delaunay set or hull set)
+};
+
+#ifdef __cplusplus
+struct IDelaBella
+{
+       static IDelaBella* Create();
+
+       virtual void Destroy() = 0;
+
+       virtual void SetErrLog(int(*proc)(void* stream, const char* fmt, ...), void* stream) = 0;
+
+       // return 0: no output 
+       // negative: all points are colinear, output hull vertices form colinear segment list, no triangles on output
+       // positive: output hull vertices form counter-clockwise ordered segment contour, delaunay and hull triangles are available
+       // if 'y' pointer is null, y coords are treated to be located immediately after every x
+       // if advance_bytes is less than 2*sizeof coordinate type, it is treated as 2*sizeof coordinate type  
+       virtual int Triangulate(int points, const float* x, const float* y = 0, int advance_bytes = 0) = 0;
+       virtual int Triangulate(int points, const double* x, const double* y = 0, int advance_bytes = 0) = 0;
+
+       // num of points passed to last call to Triangulate()
+       virtual int GetNumInputPoints() const = 0;
+
+       // num of verts returned from last call to Triangulate()
+       virtual int GetNumOutputVerts() const = 0;
+
+       virtual const DelaBella_Triangle* GetFirstDelaunayTriangle() const = 0; // valid only if Triangulate() > 0
+       virtual const DelaBella_Triangle* GetFirstHullTriangle() const = 0; // valid only if Triangulate() > 0
+       virtual const DelaBella_Vertex*   GetFirstHullVertex() const = 0; // if Triangulate() < 0 it is list, otherwise closed contour! 
+};
+#else
+void* DelaBella_Create();
+void  DelaBella_Destroy(void* db);
+void  DelaBella_SetErrLog(void* db, int(*proc)(void* stream, const char* fmt, ...), void* stream);
+int   DelaBella_TriangulateFloat(void* db, int points, float* x, float* y = 0, int advance_bytes = 0);
+int   DelaBella_TriangulateDouble(void* db, int points, double* x, double* y = 0, int advance_bytes = 0);
+int   DelaBella_GetNumInputPoints(void* db);
+int   DelaBella_GetNumOutputVerts(void* db);
+const DelaBella_Triangle* GetFirstDelaunayTriangle(void* db);
+const DelaBella_Triangle* GetFirstHullTriangle(void* db);
+const DelaBella_Vertex*   GetFirstHullVertex(void* db);
+#endif
+
+#endif
index ac427f994609d4f8b88c6ae5eb6599865356d188..7b954cd0ae9ae3655f853ada5bba3b337bf5ba54 100644 (file)
@@ -18,6 +18,8 @@
 #include <BRepMesh_OrientedEdge.hxx>
 #include <BRepMesh_Vertex.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Curve, IMeshData_Curve)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index 1566a4d916a2c2fc88a1ccd2d6cb943ffbf37e47..41faf8b8fc142aa88f4d4cc34018d1016f993abf 100644 (file)
@@ -60,7 +60,7 @@ public:
   //! Clears parameters list.
   Standard_EXPORT virtual void Clear(const Standard_Boolean isKeepEndPoints) Standard_OVERRIDE;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Curve, IMeshData_Curve)
+  DEFINE_STANDARD_RTTIEXT(BRepMeshData_Curve, IMeshData_Curve)
 
 protected:
 
index 67ce8228ff7b0454ebda2f074e4a3408daf1f5e4..1af0dc15c0a1e05fb37f3c9b0f82bff205cd7f9b 100644 (file)
@@ -19,6 +19,8 @@
 #include <BRepMesh_OrientedEdge.hxx>
 #include <BRepMesh_Vertex.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Edge, IMeshData_Edge)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index d30e550da71f4109fd2880dfd0f120bbc9ad695e..74a5a57f1995622a6e381fde2640ac20d4fdc7b5 100644 (file)
@@ -53,7 +53,7 @@ public:
   Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve (
     const Standard_Integer theIndex) const Standard_OVERRIDE;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Edge, IMeshData_Edge)
+  DEFINE_STANDARD_RTTIEXT(BRepMeshData_Edge, IMeshData_Edge)
 
 private:
 
index 2dca22c8a4c2a7844fc20734e582b6a5145b157d..833e108c27e0205ff13a0d055dc349c83201f92b 100644 (file)
@@ -18,6 +18,8 @@
 #include <BRepMesh_OrientedEdge.hxx>
 #include <BRepMesh_Vertex.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Face, IMeshData_Face)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index 1f187f7cea261548bb3405ab995f5e1fda2af4ca..bc3ef4a7e10bd6fc45c54b8cf7c7995b29a01be4 100644 (file)
@@ -47,7 +47,7 @@ public:
     const TopoDS_Wire&     theWire,
     const Standard_Integer theEdgeNb = 0) Standard_OVERRIDE;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Face, IMeshData_Face)
+  DEFINE_STANDARD_RTTIEXT(BRepMeshData_Face, IMeshData_Face)
 
 private:
 
index 08c07f8c96d9a6ff5067a981cef05d35420499e7..e62bb3cf0bf600d610651a5f2753b6605da9d69e 100644 (file)
@@ -21,6 +21,8 @@
 #include <BRepMesh_Vertex.hxx>
 #include <NCollection_IncAllocator.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Model, IMeshData_Model)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index 2b19684a73710d05dd0baf7a75f579a224238773..b76315aeac8a95afa54400a89d7b7806eaf0c2bf 100644 (file)
@@ -35,18 +35,18 @@ public:
   Standard_EXPORT virtual ~BRepMeshData_Model ();
 
   //! Returns maximum size of shape's bounding box.
-  Standard_EXPORT virtual Standard_Real GetMaxSize () const Standard_OVERRIDE
+  virtual Standard_Real GetMaxSize () const Standard_OVERRIDE
   {
     return myMaxSize;
   }
 
   //! Sets maximum size of shape's bounding box.
-  inline void SetMaxSize (const Standard_Real theValue)
+  void SetMaxSize (const Standard_Real theValue)
   {
     myMaxSize = theValue;
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Model, IMeshData_Model)
+  DEFINE_STANDARD_RTTIEXT(BRepMeshData_Model, IMeshData_Model)
 
 public: //! @name discrete faces
 
index 4c0391182922e07ed2326b27e869a7be1a559844..818b7a3c622bd45e3c6278773da5e31c3ba4c4e5 100644 (file)
@@ -19,6 +19,8 @@
 #include <BRepMesh_Vertex.hxx>
 #include <Standard_OutOfRange.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_PCurve, IMeshData_PCurve)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index 1189f9263631f98836f7be9d3212f667d65bc9db..3d8ffbcd69cb195343fe4888375e1572a163410b 100644 (file)
@@ -65,7 +65,7 @@ public:
   //! Clears parameters list.
   Standard_EXPORT virtual void Clear(const Standard_Boolean isKeepEndPoints) Standard_OVERRIDE;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_PCurve, IMeshData_PCurve)
+  DEFINE_STANDARD_RTTIEXT(BRepMeshData_PCurve, IMeshData_PCurve)
 
 protected:
 
index 8139f6a84a08d0034b1777f4ef9a200a9b217ad0..deb56edb7a894877397e0fc01095ab8f2280d9bd 100644 (file)
@@ -18,6 +18,8 @@
 #include <BRepMesh_OrientedEdge.hxx>
 #include <BRepMesh_Vertex.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Wire, IMeshData_Wire)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index bf55509684bf30f2b97e9089c3cecab381014c3d..228edb80f61da926f5c78921d73d9a148f133728 100644 (file)
@@ -52,7 +52,7 @@ public:
   Standard_EXPORT virtual TopAbs_Orientation GetEdgeOrientation (
     const Standard_Integer theIndex) const Standard_OVERRIDE;
 
-  DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Wire, IMeshData_Wire)
+  DEFINE_STANDARD_RTTIEXT(BRepMeshData_Wire, IMeshData_Wire)
 
 private:
 
index 1af663a2f1dceffe4fc2601c4864dba42c533e00..592173b5684598a789e44494678e4f77a9b9a198 100644 (file)
@@ -1,13 +1,22 @@
 IMeshData_Curve.hxx
+IMeshData_Curve.cxx
 IMeshData_Edge.hxx
+IMeshData_Edge.cxx
 IMeshData_Face.hxx
+IMeshData_Face.cxx
 IMeshData_Model.hxx
+IMeshData_Model.cxx
 IMeshData_ParametersList.hxx
+IMeshData_ParametersList.cxx
 IMeshData_ParametersListArrayAdaptor.hxx
 IMeshData_PCurve.hxx
+IMeshData_PCurve.cxx
 IMeshData_Shape.hxx
+IMeshData_Shape.cxx
 IMeshData_Status.hxx
 IMeshData_StatusOwner.hxx
 IMeshData_TessellatedShape.hxx
+IMeshData_TessellatedShape.cxx
 IMeshData_Types.hxx
 IMeshData_Wire.hxx
+IMeshData_Wire.cxx
diff --git a/src/IMeshData/IMeshData_Curve.cxx b/src/IMeshData/IMeshData_Curve.cxx
new file mode 100644 (file)
index 0000000..6756ad9
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshData_Curve.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshData_Curve, IMeshData_ParametersList)
\ No newline at end of file
index 505efad26227ca534f719116d29df1acfcf5001d..e98a684b3aa3d979ea8d328fcf6c0e44b9bb8e7a 100644 (file)
@@ -28,7 +28,7 @@ class IMeshData_Curve : public IMeshData_ParametersList
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_Curve()
+  virtual ~IMeshData_Curve()
   {
   }
 
@@ -49,12 +49,12 @@ public:
   //! Removes point with the given index.
   Standard_EXPORT virtual void RemovePoint (const Standard_Integer theIndex) = 0;
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshData_Curve, IMeshData_ParametersList)
+  DEFINE_STANDARD_RTTIEXT(IMeshData_Curve, IMeshData_ParametersList)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshData_Curve()
+  IMeshData_Curve()
   {
   }
 };
diff --git a/src/IMeshData/IMeshData_Edge.cxx b/src/IMeshData/IMeshData_Edge.cxx
new file mode 100644 (file)
index 0000000..200f74f
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshData_Edge.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshData_Edge, IMeshData_TessellatedShape)
\ No newline at end of file
index 162d2a20fa908b7803131116dd2f810026110997..5a83d344125d3ef015069ebf15d8b63bc27e2e57 100644 (file)
@@ -34,12 +34,12 @@ class IMeshData_Edge : public IMeshData_TessellatedShape, public IMeshData_Statu
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_Edge()
+  virtual ~IMeshData_Edge()
   {
   }
 
   //! Returns TopoDS_Edge attached to model.
-  inline const TopoDS_Edge& GetEdge () const
+  const TopoDS_Edge& GetEdge () const
   {
     return TopoDS::Edge (GetShape ());
   }
@@ -62,7 +62,7 @@ public:
     const Standard_Integer theIndex) const = 0;
 
   //! Clears curve and all pcurves assigned to the edge from discretization.
-  inline void Clear(const Standard_Boolean isKeepEndPoints)
+  void Clear(const Standard_Boolean isKeepEndPoints)
   {
     myCurve->Clear(isKeepEndPoints);
     for (Standard_Integer aPCurveIt = 0; aPCurveIt < PCurvesNb(); ++aPCurveIt)
@@ -72,81 +72,81 @@ public:
   }
 
   //! Returns true in case if the edge is free one, i.e. it does not have pcurves.
-  inline Standard_Boolean IsFree () const
+  Standard_Boolean IsFree () const
   {
     return (PCurvesNb () == 0);
   }
 
   //! Sets 3d curve associated with current edge.
-  inline void SetCurve (const IMeshData::ICurveHandle& theCurve)
+  void SetCurve (const IMeshData::ICurveHandle& theCurve)
   {
     myCurve = theCurve;
   }
 
   //! Returns 3d curve associated with current edge.
-  inline const IMeshData::ICurveHandle& GetCurve () const
+  const IMeshData::ICurveHandle& GetCurve () const
   {
     return myCurve;
   }
 
   //! Gets value of angular deflection for the discrete model.
-  inline Standard_Real GetAngularDeflection () const
+  Standard_Real GetAngularDeflection () const
   {
     return myAngDeflection;
   }
 
   //! Sets value of angular deflection for the discrete model.
-  inline void SetAngularDeflection (const Standard_Real theValue)
+  void SetAngularDeflection (const Standard_Real theValue)
   {
     myAngDeflection = theValue;
   }
 
   //! Returns same param flag.
   //! By default equals to flag stored in topological shape.
-  inline Standard_Boolean GetSameParam () const
+  Standard_Boolean GetSameParam () const
   {
     return mySameParam;
   }
 
   //! Updates same param flag.
-  inline void SetSameParam (const Standard_Boolean theValue)
+  void SetSameParam (const Standard_Boolean theValue)
   {
     mySameParam = theValue;
   }
 
   //! Returns same range flag.
   //! By default equals to flag stored in topological shape.
-  inline Standard_Boolean GetSameRange () const
+  Standard_Boolean GetSameRange () const
   {
     return mySameRange;
   }
 
   //! Updates same range flag.
-  inline void SetSameRange (const Standard_Boolean theValue)
+  void SetSameRange (const Standard_Boolean theValue)
   {
     mySameRange = theValue;
   }
 
   //! Returns degenerative flag.
   //! By default equals to flag stored in topological shape.
-  inline Standard_Boolean GetDegenerated () const
+  Standard_Boolean GetDegenerated () const
   {
     return myDegenerated;
   }
 
   //! Updates degenerative flag.
-  inline void SetDegenerated (const Standard_Boolean theValue)
+  void SetDegenerated (const Standard_Boolean theValue)
   {
     myDegenerated = theValue;
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshData_Edge, IMeshData_TessellatedShape)
+  DEFINE_STANDARD_RTTIEXT(IMeshData_Edge, IMeshData_TessellatedShape)
 
 protected:
 
   //! Constructor.
   //! Initializes empty model.
-  Standard_EXPORT IMeshData_Edge (const TopoDS_Edge& theEdge)
+  IMeshData_Edge (const TopoDS_Edge& theEdge)
     : IMeshData_TessellatedShape(theEdge),
       mySameParam  (BRep_Tool::SameParameter(theEdge)),
       mySameRange  (BRep_Tool::SameRange    (theEdge)),
diff --git a/src/IMeshData/IMeshData_Face.cxx b/src/IMeshData/IMeshData_Face.cxx
new file mode 100644 (file)
index 0000000..7bbfba5
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshData_Face.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshData_Face, IMeshData_TessellatedShape)
\ No newline at end of file
index 4db215de1ac92cfe94491d807142bea2dfa4c937..f86a9d767fa6f7832c7e66d232a618ffdbec8116 100644 (file)
@@ -36,7 +36,7 @@ class IMeshData_Face : public IMeshData_TessellatedShape, public IMeshData_Statu
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_Face()
+  virtual ~IMeshData_Face()
   {
   }
 
@@ -53,32 +53,32 @@ public:
     const Standard_Integer theIndex) const = 0;
 
   //! Returns face's surface.
-  inline const Handle(BRepAdaptor_HSurface)& GetSurface() const
+  const Handle(BRepAdaptor_HSurface)& GetSurface() const
   {
     return mySurface;
   }
 
   //! Returns TopoDS_Face attached to model.
-  inline const TopoDS_Face& GetFace () const
+  const TopoDS_Face& GetFace () const
   {
     return TopoDS::Face (GetShape ());
   }
 
   //! Returns whether the face discrete model is valid.
-  inline Standard_Boolean IsValid () const
+  Standard_Boolean IsValid () const
   {
     return (IsEqual(IMeshData_NoError) ||
             IsEqual(IMeshData_ReMesh)  ||
             IsEqual(IMeshData_UnorientedWire));
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshData_Face, IMeshData_TessellatedShape)
+  DEFINE_STANDARD_RTTIEXT(IMeshData_Face, IMeshData_TessellatedShape)
 
 protected:
 
   //! Constructor.
   //! Initializes empty model.
-  Standard_EXPORT IMeshData_Face (const TopoDS_Face& theFace)
+  IMeshData_Face (const TopoDS_Face& theFace)
     : IMeshData_TessellatedShape(theFace)
   {
     BRepAdaptor_Surface aSurfAdaptor(GetFace(), Standard_False);
diff --git a/src/IMeshData/IMeshData_Model.cxx b/src/IMeshData/IMeshData_Model.cxx
new file mode 100644 (file)
index 0000000..1d0ab31
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshData_Model.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshData_Model, IMeshData_Shape)
\ No newline at end of file
index 773ab6e9736d1f31f1a12d06191b916248794a68..f87ffc6fb9ad32839b5cb6c62e26457d9bbe7a62 100644 (file)
@@ -32,14 +32,14 @@ class IMeshData_Model : public IMeshData_Shape
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_Model()
+  virtual ~IMeshData_Model()
   {
   }
 
   //! Returns maximum size of shape model.
   Standard_EXPORT virtual Standard_Real GetMaxSize () const = 0;
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshData_Model, IMeshData_Shape)
+  DEFINE_STANDARD_RTTIEXT(IMeshData_Model, IMeshData_Shape)
 
 public: //! @name discrete faces
 
@@ -67,7 +67,7 @@ protected:
 
   //! Constructor.
   //! Initializes empty model.
-  Standard_EXPORT IMeshData_Model (const TopoDS_Shape& theShape)
+  IMeshData_Model (const TopoDS_Shape& theShape)
     : IMeshData_Shape(theShape)
   {
   }
diff --git a/src/IMeshData/IMeshData_PCurve.cxx b/src/IMeshData/IMeshData_PCurve.cxx
new file mode 100644 (file)
index 0000000..c04559c
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshData_PCurve.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshData_PCurve, IMeshData_ParametersList)
\ No newline at end of file
index 4c6530cf0e1d13a619d83741029fc8f28c4987df..f19634b0a0317e8dfae032c12dd71b77e730fa41 100644 (file)
@@ -29,7 +29,7 @@ class IMeshData_PCurve : public IMeshData_ParametersList
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_PCurve()
+  virtual ~IMeshData_PCurve()
   {
   }
 
@@ -54,35 +54,35 @@ public:
   Standard_EXPORT virtual void RemovePoint (const Standard_Integer theIndex) = 0;
 
   //! Returns forward flag of this pcurve.
-  inline Standard_Boolean IsForward () const
+  Standard_Boolean IsForward () const
   {
     return (myOrientation != TopAbs_REVERSED);
   }
 
   //! Returns internal flag of this pcurve.
-  inline Standard_Boolean IsInternal() const
+  Standard_Boolean IsInternal() const
   {
     return (myOrientation == TopAbs_INTERNAL);
   }
 
   //! Returns orientation of the edge associated with current pcurve.
-  inline TopAbs_Orientation GetOrientation() const
+  TopAbs_Orientation GetOrientation() const
   {
     return myOrientation;
   }
 
   //! Returns discrete face pcurve is associated to.
-  inline const IMeshData::IFacePtr& GetFace () const
+  const IMeshData::IFacePtr& GetFace () const
   {
     return myDFace;
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshData_PCurve, IMeshData_ParametersList)
+  DEFINE_STANDARD_RTTIEXT(IMeshData_PCurve, IMeshData_ParametersList)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshData_PCurve (
+  IMeshData_PCurve (
     const IMeshData::IFacePtr& theDFace,
     const TopAbs_Orientation   theOrientation)
     : myDFace(theDFace),
diff --git a/src/IMeshData/IMeshData_ParametersList.cxx b/src/IMeshData/IMeshData_ParametersList.cxx
new file mode 100644 (file)
index 0000000..4cf38bf
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshData_ParametersList.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshData_ParametersList, Standard_Transient)
\ No newline at end of file
index 8190fd2f320bd475067ae69751804b1f7997085d..f91706b0aecbb300912713ba796bd241bf3a85a4 100644 (file)
@@ -25,7 +25,7 @@ class IMeshData_ParametersList : public Standard_Transient
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_ParametersList()
+  virtual ~IMeshData_ParametersList()
   {
   }
 
@@ -38,12 +38,12 @@ public:
   //! Clears parameters list.
   Standard_EXPORT virtual void Clear(const Standard_Boolean isKeepEndPoints) = 0;
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshData_ParametersList, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(IMeshData_ParametersList, Standard_Transient)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshData_ParametersList()
+  IMeshData_ParametersList()
   {
   }
 
index 435696116320948d59897d93af17664c63600142..ae8979a491f77dfa5349fe85cf908a3c8a6108e9 100644 (file)
@@ -28,31 +28,31 @@ class IMeshData_ParametersListArrayAdaptor : public Standard_Transient
 public:
 
   //! Constructor. Initializes tool by the given parameters.
-  Standard_EXPORT IMeshData_ParametersListArrayAdaptor(
+  IMeshData_ParametersListArrayAdaptor(
     const ParametersListPtrType& theParameters)
     : myParameters (theParameters)
   {
   }
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_ParametersListArrayAdaptor()
+  virtual ~IMeshData_ParametersListArrayAdaptor()
   {
   }
 
   //! Returns lower index in parameters array.
-  Standard_EXPORT Standard_Integer Lower() const
+  Standard_Integer Lower() const
   {
     return 0;
   }
 
   //! Returns upper index in parameters array.
-  Standard_EXPORT Standard_Integer Upper() const
+  Standard_Integer Upper() const
   {
     return myParameters->ParametersNb() - 1;
   }
 
   //! Returns value of the given index.
-  Standard_EXPORT Standard_Real Value(const Standard_Integer theIndex) const
+  Standard_Real Value(const Standard_Integer theIndex) const
   {
     return myParameters->GetParameter(theIndex);
   }
diff --git a/src/IMeshData/IMeshData_Shape.cxx b/src/IMeshData/IMeshData_Shape.cxx
new file mode 100644 (file)
index 0000000..2bfe7cc
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshData_Shape.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshData_Shape, Standard_Transient)
\ No newline at end of file
index eb5100a42a72b107dbc8030abe31a960decaf679..6b23e6c03757849583578678639afa6c452ff8c9 100644 (file)
@@ -27,12 +27,12 @@ class IMeshData_Shape : public Standard_Transient
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_Shape()
+  virtual ~IMeshData_Shape()
   {
   }
 
   //! Assigns shape to discrete shape.
-  inline void SetShape (const TopoDS_Shape& theShape)
+  void SetShape (const TopoDS_Shape& theShape)
   {
     myShape = theShape;
   }
@@ -43,17 +43,17 @@ public:
     return myShape;
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshData_Shape, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(IMeshData_Shape, Standard_Transient)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshData_Shape()
+  IMeshData_Shape()
   {
   }
 
   //! Constructor.
-  Standard_EXPORT IMeshData_Shape (const TopoDS_Shape& theShape)
+  IMeshData_Shape (const TopoDS_Shape& theShape)
     : myShape(theShape)
   {
   }
index 4ba98d7daabda9ec9a593d952a10a6b6b9c067ef..e8348773de35103943e32ad5a90c703a67a708a4 100644 (file)
 //! Enumerates statuses used to notify state of discrete model.
 enum IMeshData_Status
 {
-  IMeshData_NoError               = 0x0,  //!< Mesh generation is successful.
-  IMeshData_OpenWire              = 0x1,  //!< Notifies open wire problem, which can potentially lead to incorrect results.
-  IMeshData_SelfIntersectingWire  = 0x2,  //!< Notifies self-intersections on discretized wire, which can potentially lead to incorrect results.
-  IMeshData_Failure               = 0x4,  //!< Failed to generate mesh for some faces.
-  IMeshData_ReMesh                = 0x8,  //!< Deflection of some edges has been decreased due to interference of discrete model.
-  IMeshData_UnorientedWire        = 0x10, //!< Notifies bad orientation of a wire, which can potentially lead to incorrect results. 
-  IMeshData_TooFewPoints          = 0x20, //!< Discrete model contains too few boundary points to generate mesh.
-  IMeshData_Outdated              = 0x40, //!< Existing triangulation of some faces corresponds to greater deflection than specified by parameter.
-  IMeshData_Reused                = 0x80  //!< Existing triangulation of some faces is reused as far as it fits specified deflection.
+  IMeshData_NoError               = 0x0,   //!< Mesh generation is successful.
+  IMeshData_OpenWire              = 0x1,   //!< Notifies open wire problem, which can potentially lead to incorrect results.
+  IMeshData_SelfIntersectingWire  = 0x2,   //!< Notifies self-intersections on discretized wire, which can potentially lead to incorrect results.
+  IMeshData_Failure               = 0x4,   //!< Failed to generate mesh for some faces.
+  IMeshData_ReMesh                = 0x8,   //!< Deflection of some edges has been decreased due to interference of discrete model.
+  IMeshData_UnorientedWire        = 0x10,  //!< Notifies bad orientation of a wire, which can potentially lead to incorrect results.
+  IMeshData_TooFewPoints          = 0x20,  //!< Discrete model contains too few boundary points to generate mesh.
+  IMeshData_Outdated              = 0x40,  //!< Existing triangulation of some faces corresponds to greater deflection than specified by parameter.
+  IMeshData_Reused                = 0x80,  //!< Existing triangulation of some faces is reused as far as it fits specified deflection.
+  IMeshData_UserBreak             = 0x160  //!< User break
 };
 
 #endif
index d1b54b032ce306b5c37d24d72c42f79331689ac3..abade176ddd1731c51a6e10f7b9695e5e483b78d 100644 (file)
@@ -26,36 +26,36 @@ class IMeshData_StatusOwner
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_StatusOwner()
+  virtual ~IMeshData_StatusOwner()
   {
   }
 
   //! Returns true in case if status is strictly equal to the given value.
-  inline Standard_Boolean IsEqual(const IMeshData_Status theValue) const
+  Standard_Boolean IsEqual(const IMeshData_Status theValue) const
   {
     return (myStatus == theValue);
   }
 
   //! Returns true in case if status is set.
-  inline Standard_Boolean IsSet(const IMeshData_Status theValue) const
+  Standard_Boolean IsSet(const IMeshData_Status theValue) const
   {
     return (myStatus & theValue) != 0;
   }
 
   //! Adds status to status flags of a face.
-  inline void SetStatus(const IMeshData_Status theValue)
+  void SetStatus(const IMeshData_Status theValue)
   {
     myStatus |= theValue;
   }
 
   //! Adds status to status flags of a face.
-  inline void UnsetStatus(const IMeshData_Status theValue)
+  void UnsetStatus(const IMeshData_Status theValue)
   {
     myStatus &= ~theValue;
   }
 
   //! Returns complete status mask.
-  inline Standard_Integer GetStatusMask() const
+  Standard_Integer GetStatusMask() const
   {
     return myStatus;
   }
@@ -63,7 +63,7 @@ public:
 protected:
 
   //! Constructor. Initializes default status.
-  Standard_EXPORT IMeshData_StatusOwner()
+  IMeshData_StatusOwner()
     : myStatus(IMeshData_NoError)
   {
   }
diff --git a/src/IMeshData/IMeshData_TessellatedShape.cxx b/src/IMeshData/IMeshData_TessellatedShape.cxx
new file mode 100644 (file)
index 0000000..af6065c
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshData_TessellatedShape.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshData_TessellatedShape, IMeshData_Shape)
\ No newline at end of file
index 94001b032d85cb08591ea31d6acaade9b9c9271c..02246640fb539f815707f3ef8d7bf8bd71417c02 100644 (file)
@@ -26,34 +26,34 @@ class IMeshData_TessellatedShape : public IMeshData_Shape
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_TessellatedShape()
+  virtual ~IMeshData_TessellatedShape()
   {
   }
 
   //! Gets deflection value for the discrete model.
-  inline Standard_Real GetDeflection () const
+  Standard_Real GetDeflection () const
   {
     return myDeflection;
   }
 
   //! Sets deflection value for the discrete model.
-  inline void SetDeflection (const Standard_Real theValue)
+  void SetDeflection (const Standard_Real theValue)
   {
     myDeflection = theValue;
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshData_TessellatedShape, IMeshData_Shape)
+  DEFINE_STANDARD_RTTIEXT(IMeshData_TessellatedShape, IMeshData_Shape)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshData_TessellatedShape ()
+  IMeshData_TessellatedShape ()
     : myDeflection(RealLast())
   {
   }
 
   //! Constructor.
-  Standard_EXPORT IMeshData_TessellatedShape (const TopoDS_Shape& theShape)
+  IMeshData_TessellatedShape (const TopoDS_Shape& theShape)
     : IMeshData_Shape(theShape),
       myDeflection(RealLast())
   {
diff --git a/src/IMeshData/IMeshData_Wire.cxx b/src/IMeshData/IMeshData_Wire.cxx
new file mode 100644 (file)
index 0000000..05473ae
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshData_Wire.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshData_Wire, IMeshData_TessellatedShape)
\ No newline at end of file
index e2c2634f71a81e913e911b68c392e4672d3326a7..6e71e24abc10e43beda2842b587b31a6caf845ce 100644 (file)
@@ -32,12 +32,12 @@ class IMeshData_Wire : public IMeshData_TessellatedShape, public IMeshData_Statu
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshData_Wire()
+  virtual ~IMeshData_Wire()
   {
   }
 
   //! Returns TopoDS_Face attached to model.
-  inline const TopoDS_Wire& GetWire () const
+  const TopoDS_Wire& GetWire () const
   {
     return TopoDS::Wire (GetShape ());
   }
@@ -59,13 +59,13 @@ public:
   Standard_EXPORT virtual TopAbs_Orientation GetEdgeOrientation (
     const Standard_Integer theIndex) const = 0;
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshData_Wire, IMeshData_TessellatedShape)
+  DEFINE_STANDARD_RTTIEXT(IMeshData_Wire, IMeshData_TessellatedShape)
 
 protected:
 
   //! Constructor.
   //! Initializes empty model.
-  Standard_EXPORT IMeshData_Wire(const TopoDS_Wire& theWire)
+  IMeshData_Wire(const TopoDS_Wire& theWire)
     : IMeshData_TessellatedShape(theWire)
   {
   }
index e582bc1d1b462e41b1f5252a5d58d4e7af538bfc..7ffc2884ef313dae471a270411c706754eca1c6b 100644 (file)
@@ -1,12 +1,20 @@
 IMeshTools_Context.hxx
+IMeshTools_Context.cxx
 IMeshTools_CurveTessellator.hxx
+IMeshTools_CurveTessellator.cxx
 IMeshTools_MeshAlgo.hxx
+IMeshTools_MeshAlgo.cxx
 IMeshTools_MeshAlgoFactory.hxx
+IMeshTools_MeshAlgoFactory.cxx
+IMeshTools_MeshAlgoType.hxx
 IMeshTools_MeshBuilder.hxx
 IMeshTools_MeshBuilder.cxx
 IMeshTools_ModelAlgo.hxx
+IMeshTools_ModelAlgo.cxx
 IMeshTools_ModelBuilder.hxx
+IMeshTools_ModelBuilder.cxx
 IMeshTools_Parameters.hxx
 IMeshTools_ShapeExplorer.hxx
 IMeshTools_ShapeExplorer.cxx
 IMeshTools_ShapeVisitor.hxx
+IMeshTools_ShapeVisitor.cxx
diff --git a/src/IMeshTools/IMeshTools_Context.cxx b/src/IMeshTools/IMeshTools_Context.cxx
new file mode 100644 (file)
index 0000000..3524433
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshTools_Context.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshTools_Context, IMeshData_Shape)
\ No newline at end of file
index fe77996c2e40e19cbacca0d5cc141d6fc9a584b5..c9f68954c7190be3fdc49eb78e243e00349fc53f 100644 (file)
@@ -31,18 +31,18 @@ class IMeshTools_Context : public IMeshData_Shape
 public:
 
   //! Constructor.
-  Standard_EXPORT IMeshTools_Context()
+  IMeshTools_Context()
   {
   }
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshTools_Context()
+  virtual ~IMeshTools_Context()
   {
   }
 
   //! Builds model using assined model builder.
   //! @return True on success, False elsewhere.
-  Standard_EXPORT virtual Standard_Boolean BuildModel ()
+  virtual Standard_Boolean BuildModel ()
   {
     if (myModelBuilder.IsNull())
     {
@@ -56,7 +56,7 @@ public:
 
   //! Performs discretization of model edges using assigned edge discret algorithm.
   //! @return True on success, False elsewhere.
-  Standard_EXPORT virtual Standard_Boolean DiscretizeEdges()
+  virtual Standard_Boolean DiscretizeEdges()
   {
     if (myModel.IsNull() || myEdgeDiscret.IsNull())
     {
@@ -70,7 +70,7 @@ public:
   //! Performs healing of discrete model built by DiscretizeEdges() method
   //! using assigned healing algorithm.
   //! @return True on success, False elsewhere.
-  Standard_EXPORT virtual Standard_Boolean HealModel()
+  virtual Standard_Boolean HealModel()
   {
     if (myModel.IsNull())
     {
@@ -85,7 +85,7 @@ public:
   //! Performs pre-processing of discrete model using assigned algorithm.
   //! Performs auxiliary actions such as cleaning shape from old triangulation.
   //! @return True on success, False elsewhere.
-  Standard_EXPORT virtual Standard_Boolean PreProcessModel()
+  virtual Standard_Boolean PreProcessModel()
   {
     if (myModel.IsNull())
     {
@@ -112,7 +112,7 @@ public:
 
   //! Performs post-processing of discrete model using assigned algorithm.
   //! @return True on success, False elsewhere.
-  Standard_EXPORT virtual Standard_Boolean PostProcessModel()
+  virtual Standard_Boolean PostProcessModel()
   {
     if (myModel.IsNull())
     {
@@ -125,7 +125,7 @@ public:
   }
 
   //! Cleans temporary context data.
-  Standard_EXPORT virtual void Clean()
+  virtual void Clean()
   {
     if (myParameters.CleanModel)
     {
@@ -134,96 +134,96 @@ public:
   }
 
   //! Gets instance of a tool to be used to build discrete model.
-  inline const Handle (IMeshTools_ModelBuilder)& GetModelBuilder () const
+  const Handle (IMeshTools_ModelBuilder)& GetModelBuilder () const
   {
     return myModelBuilder;
   }
 
   //! Sets instance of a tool to be used to build discrete model.
-  inline void SetModelBuilder (const Handle (IMeshTools_ModelBuilder)& theBuilder)
+  void SetModelBuilder (const Handle (IMeshTools_ModelBuilder)& theBuilder)
   {
     myModelBuilder = theBuilder;
   }
 
   //! Gets instance of a tool to be used to discretize edges of a model.
-  inline const Handle (IMeshTools_ModelAlgo)& GetEdgeDiscret () const
+  const Handle (IMeshTools_ModelAlgo)& GetEdgeDiscret () const
   {
     return myEdgeDiscret;
   }
 
   //! Sets instance of a tool to be used to discretize edges of a model.
-  inline void SetEdgeDiscret (const Handle (IMeshTools_ModelAlgo)& theEdgeDiscret)
+  void SetEdgeDiscret (const Handle (IMeshTools_ModelAlgo)& theEdgeDiscret)
   {
     myEdgeDiscret = theEdgeDiscret;
   }
 
   //! Gets instance of a tool to be used to heal discrete model.
-  inline const Handle(IMeshTools_ModelAlgo)& GetModelHealer() const
+  const Handle(IMeshTools_ModelAlgo)& GetModelHealer() const
   {
     return myModelHealer;
   }
 
   //! Sets instance of a tool to be used to heal discrete model.
-  inline void SetModelHealer(const Handle(IMeshTools_ModelAlgo)& theModelHealer)
+  void SetModelHealer(const Handle(IMeshTools_ModelAlgo)& theModelHealer)
   {
     myModelHealer = theModelHealer;
   }
 
   //! Gets instance of pre-processing algorithm.
-  inline const Handle(IMeshTools_ModelAlgo)& GetPreProcessor() const
+  const Handle(IMeshTools_ModelAlgo)& GetPreProcessor() const
   {
     return myPreProcessor;
   }
 
   //! Sets instance of pre-processing algorithm.
-  inline void SetPreProcessor(const Handle(IMeshTools_ModelAlgo)& thePreProcessor)
+  void SetPreProcessor(const Handle(IMeshTools_ModelAlgo)& thePreProcessor)
   {
     myPreProcessor = thePreProcessor;
   }
 
   //! Gets instance of meshing algorithm.
-  inline const Handle(IMeshTools_ModelAlgo)& GetFaceDiscret() const
+  const Handle(IMeshTools_ModelAlgo)& GetFaceDiscret() const
   {
     return myFaceDiscret;
   }
 
   //! Sets instance of meshing algorithm.
-  inline void SetFaceDiscret(const Handle(IMeshTools_ModelAlgo)& theFaceDiscret)
+  void SetFaceDiscret(const Handle(IMeshTools_ModelAlgo)& theFaceDiscret)
   {
     myFaceDiscret = theFaceDiscret;
   }
 
   //! Gets instance of post-processing algorithm.
-  inline const Handle(IMeshTools_ModelAlgo)& GetPostProcessor() const
+  const Handle(IMeshTools_ModelAlgo)& GetPostProcessor() const
   {
     return myPostProcessor;
   }
 
   //! Sets instance of post-processing algorithm.
-  inline void SetPostProcessor(const Handle(IMeshTools_ModelAlgo)& thePostProcessor)
+  void SetPostProcessor(const Handle(IMeshTools_ModelAlgo)& thePostProcessor)
   {
     myPostProcessor = thePostProcessor;
   }
 
   //! Gets parameters to be used for meshing.
-  inline const IMeshTools_Parameters& GetParameters () const 
+  const IMeshTools_Parameters& GetParameters () const 
   {
     return myParameters;
   }
 
   //! Gets reference to parameters to be used for meshing.
-  inline IMeshTools_Parameters& ChangeParameters ()
+  IMeshTools_Parameters& ChangeParameters ()
   {
     return myParameters;
   }
 
   //! Returns discrete model of a shape.
-  inline const Handle (IMeshData_Model)& GetModel () const
+  const Handle (IMeshData_Model)& GetModel () const
   {
     return myModel;
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshTools_Context, IMeshData_Shape)
+  DEFINE_STANDARD_RTTIEXT(IMeshTools_Context, IMeshData_Shape)
 
 private:
 
diff --git a/src/IMeshTools/IMeshTools_CurveTessellator.cxx b/src/IMeshTools/IMeshTools_CurveTessellator.cxx
new file mode 100644 (file)
index 0000000..20493cd
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshTools_CurveTessellator.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshTools_CurveTessellator, Standard_Transient)
\ No newline at end of file
index 2cbd66bfd69841db28a991c5b66939df75368264..351ce0edc3c6d012e45b7ef3cacd39cadbe5bdca 100644 (file)
@@ -27,7 +27,7 @@ class IMeshTools_CurveTessellator : public Standard_Transient
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshTools_CurveTessellator()
+  virtual ~IMeshTools_CurveTessellator()
   {
   }
 
@@ -44,12 +44,12 @@ public:
     gp_Pnt&                thePoint,
     Standard_Real&         theParameter) const = 0;
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshTools_CurveTessellator, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(IMeshTools_CurveTessellator, Standard_Transient)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshTools_CurveTessellator()
+  IMeshTools_CurveTessellator()
   {
   }
 };
diff --git a/src/IMeshTools/IMeshTools_MeshAlgo.cxx b/src/IMeshTools/IMeshTools_MeshAlgo.cxx
new file mode 100644 (file)
index 0000000..9794c4d
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshTools_MeshAlgo.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshTools_MeshAlgo, Standard_Transient)
\ No newline at end of file
index fb8e0b6d49f620d3dbaf4a9d8fe26d58e0c1f7de..a88ada97f141eebec9be4954898134b988cfb2b5 100644 (file)
@@ -28,7 +28,7 @@ class IMeshTools_MeshAlgo : public Standard_Transient
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshTools_MeshAlgo()
+  virtual ~IMeshTools_MeshAlgo()
   {
   }
 
@@ -37,12 +37,12 @@ public:
     const IMeshData::IFaceHandle& theDFace,
     const IMeshTools_Parameters&  theParameters) = 0;
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshAlgo, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(IMeshTools_MeshAlgo, Standard_Transient)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshTools_MeshAlgo()
+  IMeshTools_MeshAlgo()
   {
   }
 };
diff --git a/src/IMeshTools/IMeshTools_MeshAlgoFactory.cxx b/src/IMeshTools/IMeshTools_MeshAlgoFactory.cxx
new file mode 100644 (file)
index 0000000..4f13ef5
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshTools_MeshAlgoFactory.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshTools_MeshAlgoFactory, Standard_Transient)
\ No newline at end of file
index 47008755bcd913cf6e33ce68e944b7af676fb613..2e4eff677800022644f71e75b39896f44893d5b5 100644 (file)
@@ -30,7 +30,7 @@ class IMeshTools_MeshAlgoFactory : public Standard_Transient
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshTools_MeshAlgoFactory()
+  virtual ~IMeshTools_MeshAlgoFactory()
   {
   }
 
@@ -39,12 +39,12 @@ public:
     const GeomAbs_SurfaceType    theSurfaceType,
     const IMeshTools_Parameters& theParameters) const = 0;
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshAlgoFactory, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(IMeshTools_MeshAlgoFactory, Standard_Transient)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshTools_MeshAlgoFactory()
+  IMeshTools_MeshAlgoFactory()
   {
   }
 };
diff --git a/src/IMeshTools/IMeshTools_MeshAlgoType.hxx b/src/IMeshTools/IMeshTools_MeshAlgoType.hxx
new file mode 100644 (file)
index 0000000..ca71c6c
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright (c) 2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _IMeshTools_MeshAlgoType_HeaderFile
+#define _IMeshTools_MeshAlgoType_HeaderFile
+
+//! Enumerates built-in meshing algorithms factories implementing IMeshTools_MeshAlgoFactory interface.
+enum IMeshTools_MeshAlgoType
+{
+  IMeshTools_MeshAlgoType_DEFAULT = -1, //!< use global default (IMeshTools_MeshAlgoType_Watson or CSF_MeshAlgo)
+  IMeshTools_MeshAlgoType_Watson  = 0,  //!< generate 2D Delaunay triangulation based on Watson algorithm (BRepMesh_MeshAlgoFactory)
+  IMeshTools_MeshAlgoType_Delabella,    //!< generate 2D Delaunay triangulation based on Delabella algorithm (BRepMesh_DelabellaMeshAlgoFactory)
+};
+
+#endif
index 3b67a6c7985f51da16e72f775c500914d325221e..95c2f9bdb3b58ce14b36c84672a58e47332e9989 100644 (file)
@@ -17,6 +17,8 @@
 #include <IMeshData_Face.hxx>
 #include <OSD_Parallel.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(IMeshTools_MeshBuilder, Message_Algorithm)
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
index 8c0d314224fbf19432bcfe36a619b0be3a7f4f30..c672a31dd1769604a6f7ecedec2ab544bc6518d2 100644 (file)
@@ -50,13 +50,13 @@ public:
   Standard_EXPORT virtual ~IMeshTools_MeshBuilder();
 
   //! Sets context for algorithm.
-  inline void SetContext (const Handle (IMeshTools_Context)& theContext)
+  void SetContext (const Handle (IMeshTools_Context)& theContext)
   {
     myContext = theContext;
   }
 
   //! Gets context of algorithm.
-  inline const Handle (IMeshTools_Context)& GetContext () const
+  const Handle (IMeshTools_Context)& GetContext () const
   {
     return myContext;
   }
@@ -64,7 +64,7 @@ public:
   //! Performs meshing ot the shape using current context.
   Standard_EXPORT virtual void Perform ();
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshBuilder, Message_Algorithm)
+  DEFINE_STANDARD_RTTIEXT(IMeshTools_MeshBuilder, Message_Algorithm)
 
 private:
 
diff --git a/src/IMeshTools/IMeshTools_ModelAlgo.cxx b/src/IMeshTools/IMeshTools_ModelAlgo.cxx
new file mode 100644 (file)
index 0000000..3f8d2e7
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshTools_ModelAlgo.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshTools_ModelAlgo, Standard_Transient)
\ No newline at end of file
index 963c880c7559175cfb80228b9d4fdcbb306d6cbd..931939da7e26b8462b3916e0adf20344963a423f 100644 (file)
@@ -30,7 +30,7 @@ class IMeshTools_ModelAlgo : public Standard_Transient
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshTools_ModelAlgo()
+  virtual ~IMeshTools_ModelAlgo()
   {
   }
 
@@ -51,12 +51,12 @@ public:
     }
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ModelAlgo, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(IMeshTools_ModelAlgo, Standard_Transient)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshTools_ModelAlgo()
+  IMeshTools_ModelAlgo()
   {
   }
 
diff --git a/src/IMeshTools/IMeshTools_ModelBuilder.cxx b/src/IMeshTools/IMeshTools_ModelBuilder.cxx
new file mode 100644 (file)
index 0000000..3e34518
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshTools_ModelBuilder.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshTools_ModelBuilder, Message_Algorithm)
\ No newline at end of file
index 5d6d4169325d65bf87e6fecc5b9eb068f3f96586..9d74d99b01f24e43553c769dacc27a20e43e264f 100644 (file)
@@ -21,8 +21,8 @@
 #include <Standard_Failure.hxx>
 #include <Standard_Type.hxx>
 #include <TopoDS_Shape.hxx>
+#include <IMeshData_Model.hxx>
 
-class IMeshData_Model;
 struct IMeshTools_Parameters;
 
 //! Interface class represents API for tool building discrete model.
@@ -36,7 +36,7 @@ class IMeshTools_ModelBuilder : public Message_Algorithm
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshTools_ModelBuilder()
+  virtual ~IMeshTools_ModelBuilder()
   {
   }
 
@@ -61,12 +61,12 @@ public:
     }
   }
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ModelBuilder, Message_Algorithm)
+  DEFINE_STANDARD_RTTIEXT(IMeshTools_ModelBuilder, Message_Algorithm)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshTools_ModelBuilder()
+  IMeshTools_ModelBuilder()
   {
   }
 
index 6279708a78afae8540b81dd443583432e6db2c87..4bbff6a902f6b8b8ee988c6ac6d7c501ca855e83 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef _IMeshTools_Parameters_HeaderFile
 #define _IMeshTools_Parameters_HeaderFile
 
+#include <IMeshTools_MeshAlgoType.hxx>
 #include <Precision.hxx>
 
 //! Structure storing meshing parameters
@@ -24,6 +25,7 @@ struct IMeshTools_Parameters {
   //! Default constructor
   IMeshTools_Parameters ()
     :
+    MeshAlgo (IMeshTools_MeshAlgoType_DEFAULT),
     Angle(0.5),
     Deflection(0.001),
     AngleInterior(-1.0),
@@ -34,7 +36,9 @@ struct IMeshTools_Parameters {
     InternalVerticesMode (Standard_True),
     ControlSurfaceDeflection (Standard_True),
     CleanModel (Standard_True),
-    AdjustMinSize (Standard_False)
+    AdjustMinSize (Standard_False),
+    ForceFaceDeflection (Standard_False),
+    AllowQualityDecrease (Standard_False)
   {
   }
 
@@ -45,6 +49,9 @@ struct IMeshTools_Parameters {
     return 0.1;
   }
 
+  //! 2D Delaunay triangulation algorithm factory to use
+  IMeshTools_MeshAlgoType                          MeshAlgo;
+
   //! Angular deflection used to tessellate the boundary edges
   Standard_Real                                    Angle;
 
@@ -57,7 +64,8 @@ struct IMeshTools_Parameters {
   //! Linear deflection used to tessellate the face interior
   Standard_Real                                    DeflectionInterior;
   
-  //! Minimal allowed size of mesh element
+  //! Minimum size parameter limiting size of triangle's edges to prevent 
+  //! sinking into amplification in case of distorted curves and surfaces.
   Standard_Real                                    MinSize;
 
   //! Switches on/off multi-thread computation
@@ -83,6 +91,14 @@ struct IMeshTools_Parameters {
   //! Enables/disables local adjustment of min size depending on edge size.
   //! Disabled by default.
   Standard_Boolean                                 AdjustMinSize;
+
+  //! Enables/disables usage of shape tolerances for computing face deflection.
+  //! Disabled by default.
+  Standard_Boolean                                 ForceFaceDeflection;
+
+  //! Allows/forbids the decrease of the quality of the generated mesh
+  //! over the existing one.
+  Standard_Boolean                                 AllowQualityDecrease;
 };
 
 #endif
index 2dc244a73cdfd7a1bc3c29b6140e4ac16a5eab62..322b10beaa517fae41816bf97f43b47bca006668 100644 (file)
@@ -25,6 +25,8 @@
 #include <TopTools_MapOfShape.hxx>
 #include <Geom_Surface.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(IMeshTools_ShapeExplorer, IMeshData_Shape)
+
 namespace
 {
   //=======================================================================
@@ -34,6 +36,7 @@ namespace
   //=======================================================================
   void visitEdges (const Handle (IMeshTools_ShapeVisitor)& theVisitor,
                    const TopoDS_Shape&                     theShape,
+                   const Standard_Boolean                  isResetLocation,
                    const TopAbs_ShapeEnum                  theToFind,
                    const TopAbs_ShapeEnum                  theToAvoid = TopAbs_SHAPE)
   {
@@ -46,7 +49,9 @@ namespace
         continue;
       }
 
-      theVisitor->Visit (aEdge);
+      theVisitor->Visit (isResetLocation ?
+        TopoDS::Edge (aEdge.Located (TopLoc_Location ())) :
+        aEdge);
     }
   }
 }
@@ -77,7 +82,7 @@ void IMeshTools_ShapeExplorer::Accept (
   const Handle (IMeshTools_ShapeVisitor)& theVisitor)
 {
   // Explore all free edges in shape.
-  visitEdges (theVisitor, GetShape (), TopAbs_EDGE, TopAbs_FACE);
+  visitEdges (theVisitor, GetShape (), Standard_True, TopAbs_EDGE, TopAbs_FACE);
 
   // Explore all related to some face edges in shape.
   // make array of faces suitable for processing (excluding faces without surface)
@@ -85,7 +90,6 @@ void IMeshTools_ShapeExplorer::Accept (
   BRepLib::ReverseSortFaces (GetShape (), aFaceList);
   TopTools_MapOfShape aFaceMap;
 
-  TopLoc_Location aDummyLoc;
   const TopLoc_Location aEmptyLoc;
   TopTools_ListIteratorOfListOfShape aFaceIter (aFaceList);
   for (; aFaceIter.More (); aFaceIter.Next ())
@@ -98,14 +102,13 @@ void IMeshTools_ShapeExplorer::Accept (
     }
 
     const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Value ());
-    const Handle (Geom_Surface)& aSurf = BRep_Tool::Surface (aFace, aDummyLoc);
-    if (aSurf.IsNull())
+    if (!BRep_Tool::IsGeometric (aFace))
     {
       continue;
     }
 
     // Explore all edges in face.
-    visitEdges (theVisitor, aFace, TopAbs_EDGE);
+    visitEdges (theVisitor, aFace, Standard_False, TopAbs_EDGE);
 
     // Store only forward faces in order to prevent inverse issue.
     theVisitor->Visit (TopoDS::Face (aFace.Oriented (TopAbs_FORWARD)));
index 0e96ddc60e115d005b3b2399eed2ae36599a327c..e5e4e10cb7eb6259fa3f54f515cc15863319697d 100644 (file)
@@ -35,7 +35,7 @@ public:
   //! Starts exploring of a shape.
   Standard_EXPORT virtual void Accept (const Handle (IMeshTools_ShapeVisitor)& theVisitor);
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ShapeExplorer, IMeshData_Shape)
+  DEFINE_STANDARD_RTTIEXT(IMeshTools_ShapeExplorer, IMeshData_Shape)
 };
 
 #endif
\ No newline at end of file
diff --git a/src/IMeshTools/IMeshTools_ShapeVisitor.cxx b/src/IMeshTools/IMeshTools_ShapeVisitor.cxx
new file mode 100644 (file)
index 0000000..069e5ba
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2020-09-28
+// Copyright (c) 2020 OPEN CASCADE SAS
+// Created by: Maria KRYLOVA
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <IMeshTools_ShapeVisitor.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IMeshTools_ShapeVisitor, Standard_Transient)
\ No newline at end of file
index 50ee23dc49e1af2e6a1b2d62955abda56d4e551e..517aeeef90874b7b612d30b13a9fe513838f5cc3 100644 (file)
@@ -28,7 +28,7 @@ class IMeshTools_ShapeVisitor : public Standard_Transient
 public:
 
   //! Destructor.
-  Standard_EXPORT virtual ~IMeshTools_ShapeVisitor()
+  virtual ~IMeshTools_ShapeVisitor()
   {
   }
 
@@ -38,12 +38,12 @@ public:
   //! Handles TopoDS_Edge object.
   Standard_EXPORT virtual void Visit (const TopoDS_Edge& theEdge) = 0;
 
-  DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ShapeVisitor, Standard_Transient)
+  DEFINE_STANDARD_RTTIEXT(IMeshTools_ShapeVisitor, Standard_Transient)
 
 protected:
 
   //! Constructor.
-  Standard_EXPORT IMeshTools_ShapeVisitor()
+  IMeshTools_ShapeVisitor()
   {
   }
 };
index 5ae491e3f328aabb254a6d154f40e903caf75a70..9677102d34a6ab868fe5939b2bee807476701094 100755 (executable)
@@ -2,7 +2,5 @@ MeshTest.cxx
 MeshTest.hxx
 MeshTest_CheckTopology.cxx
 MeshTest_CheckTopology.hxx
-MeshTest_DrawableMesh.cxx
-MeshTest_DrawableMesh.hxx
 MeshTest_PluginCommands.cxx
 MeshTest_Debug.cxx
index c7ff84c7f236d5be0dbb96831cb2d6f1f35deff2..94ab00716d6595168337962221a8470826937735 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <MeshTest.hxx>
+
+#include <stdio.h>
 
-#include <AppCont_ContMatrices.hxx>
 #include <Bnd_Box.hxx>
 #include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
 #include <BRepAdaptor_Surface.hxx>
 #include <BRepBndLib.hxx>
 #include <BRepBuilderAPI_MakeFace.hxx>
 #include <BRepBuilderAPI_MakePolygon.hxx>
 #include <BRepBuilderAPI_MakeVertex.hxx>
 #include <BRepLib.hxx>
-#include <BRepMesh_DataStructureOfDelaun.hxx>
-#include <BRepMesh_Delaun.hxx>
-#include <BRepMesh_Edge.hxx>
-#include <BRepMesh_FastDiscret.hxx>
 #include <BRepMesh_IncrementalMesh.hxx>
-#include <BRepMesh_Triangle.hxx>
-#include <BRepMesh_Vertex.hxx>
 #include <BRepTest.hxx>
 #include <BRepTools.hxx>
 #include <CSLib.hxx>
-#include <CSLib_DerivativeStatus.hxx>
 #include <DBRep.hxx>
-#include <Draw.hxx>
 #include <Draw_Appli.hxx>
-#include <Draw_Interpretor.hxx>
-#include <Draw_Marker3D.hxx>
-#include <Draw_MarkerShape.hxx>
+#include <Draw_ProgressIndicator.hxx>
 #include <Draw_Segment2D.hxx>
 #include <DrawTrSurf.hxx>
-#include <Extrema_LocateExtPC.hxx>
-#include <GCPnts_UniformAbscissa.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_Surface.hxx>
-#include <GeomAdaptor_Curve.hxx>
 #include <GeometryTest.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Trsf.hxx>
-#include <math.hxx>
-#include <math_Matrix.hxx>
-#include <math_Vector.hxx>
-#include <MeshTest.hxx>
-#include <MeshTest_DrawableMesh.hxx>
-#include <PLib.hxx>
+#include <IMeshData_Status.hxx>
+#include <Message.hxx>
 #include <Poly_Connect.hxx>
-#include <Poly_PolygonOnTriangulation.hxx>
-#include <Poly_Triangulation.hxx>
-#include <Precision.hxx>
-#include <Standard_Stream.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HArray1OfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include <TopAbs_ShapeEnum.hxx>
 #include <TopExp_Explorer.hxx>
-#include <TopLoc_Location.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <TopTools_MapIteratorOfMapOfShape.hxx>
-#include <Draw_ProgressIndicator.hxx>
+#include <TopoDS.hxx>
+
+#include <BRepMesh_Context.hxx>
+#include <BRepMesh_FaceDiscret.hxx>
+#include <BRepMesh_MeshAlgoFactory.hxx>
+#include <BRepMesh_DelabellaMeshAlgoFactory.hxx>
 
-#include <stdio.h>
 //epa Memory leaks test
 //OAN: for triepoints
 #ifdef _WIN32
@@ -92,8 +57,6 @@ Standard_IMPORT Draw_Viewer dout;
 #define MAX2(X, Y)     (  Abs(X) > Abs(Y)? Abs(X) : Abs(Y) )
 #define MAX3(X, Y, Z)  ( MAX2 ( MAX2(X,Y) , Z) )
 
-
-
 #define ONETHIRD 0.333333333333333333333333333333333333333333333333333333333333
 #define TWOTHIRD 0.666666666666666666666666666666666666666666666666666666666666
 
@@ -118,8 +81,11 @@ static Standard_Integer incrementalmesh(Draw_Interpretor& di, Standard_Integer n
 Builds triangular mesh for the shape\n\
 usage: incmesh Shape LinearDeflection [options]\n\
 options:\n\
-        -a val          angular deflection in deg\n\
+        -a val          angular deflection for edges in deg\n\
                         (default ~28.64 deg = 0.5 rad)\n\n\
+        -ai val         angular deflection inside of faces in deg\n\
+                        (default ~57.29 deg = 1 rad)\n\n\
+        -di val         Linear deflection used to tessellate the face interior.\n\
         -min            minimum size parameter limiting size of triangle's\n\
                         edges to prevent sinking into amplification in case\n\
                         of distorted curves and surfaces\n\n\
@@ -130,7 +96,11 @@ options:\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\
-        -adjust_min     enables local adjustment of min size depending on edge size\n";
+        -adjust_min     enables local adjustment of min size depending on edge size (switched off by default)\n\
+        -force_face_def disables usage of shape tolerances for computing face deflection (switched off by default)\n\
+        -decrease       enforces the meshing of the shape even if current mesh satisfies the new criteria\
+                        (switched off by default).\n\
+        -algo {watson|delabella} changes core triangulation algorithm to one with specified id (watson is used by default)\n";
     return 0;
   }
 
@@ -141,15 +111,11 @@ 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_Boolean isControlSurDef = Standard_True;
-  Standard_Boolean isAdjustMinSize = Standard_False;
+  IMeshTools_Parameters aMeshParams;
+  aMeshParams.Deflection = aMeshParams.DeflectionInterior = 
+    Max(Draw::Atof(argv[2]), Precision::Confusion());
 
+  Handle (IMeshTools_Context) aContext = new BRepMesh_Context;
   if (nbarg > 3)
   {
     Standard_Integer i = 3;
@@ -161,74 +127,128 @@ options:\n\
       if (aOpt == "")
         continue;
       else if (aOpt == "-relative")
-        isRelative = Standard_True;
+        aMeshParams.Relative = Standard_True;
       else if (aOpt == "-parallel")
-        isInParallel = Standard_True;
+        aMeshParams.InParallel = Standard_True;
       else if (aOpt == "-int_vert_off")
-        isIntVertices = Standard_False;
+        aMeshParams.InternalVerticesMode = Standard_False;
       else if (aOpt == "-surf_def_off")
-        isControlSurDef = Standard_False;
+        aMeshParams.ControlSurfaceDeflection = Standard_False;
       else if (aOpt == "-adjust_min")
-        isAdjustMinSize = Standard_True;
+        aMeshParams.AdjustMinSize = Standard_True;
+      else if (aOpt == "-force_face_def")
+        aMeshParams.ForceFaceDeflection = Standard_True;
+      else if (aOpt == "-decrease")
+        aMeshParams.AllowQualityDecrease = Standard_True;
       else if (i < nbarg)
       {
-        Standard_Real aVal = Draw::Atof(argv[i++]);
-        if (aOpt == "-a")
-          aAngDeflection = aVal * M_PI / 180.;
-        else if (aOpt == "-min")
-          aMinSize = aVal;
+        if (aOpt == "-algo")
+        {
+          TCollection_AsciiString anAlgoStr (argv[i++]);
+          anAlgoStr.LowerCase();
+          if (anAlgoStr == "watson"
+           || anAlgoStr == "0")
+          {
+            aMeshParams.MeshAlgo = IMeshTools_MeshAlgoType_Watson;
+            aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_MeshAlgoFactory));
+          }
+          else if (anAlgoStr == "delabella"
+                || anAlgoStr == "1")
+          {
+            aMeshParams.MeshAlgo = IMeshTools_MeshAlgoType_Delabella;
+            aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_DelabellaMeshAlgoFactory));
+          }
+          else if (anAlgoStr == "-1"
+                || anAlgoStr == "default")
+          {
+            // already handled by BRepMesh_Context constructor
+            //aMeshParams.MeshAlgo = IMeshTools_MeshAlgoType_DEFAULT;
+          }
+          else
+          {
+            di << "Syntax error at " << anAlgoStr;
+            return 1;
+          }
+        }
         else
-          --i;
+        {
+          Standard_Real aVal = Draw::Atof(argv[i++]);
+          if (aOpt == "-a")
+          {
+            aMeshParams.Angle = aVal * M_PI / 180.;
+          }
+          else if (aOpt == "-ai")
+          {
+            aMeshParams.AngleInterior = aVal * M_PI / 180.;
+          }
+          else if (aOpt == "-min")
+            aMeshParams.MinSize = aVal;
+          else if (aOpt == "-di")
+          {
+            aMeshParams.DeflectionInterior = aVal;
+          }
+          else
+            --i;
+        }
       }
     }
   }
 
   di << "Incremental Mesh, multi-threading "
-     << (isInParallel ? "ON" : "OFF") << "\n";
+     << (aMeshParams.InParallel ? "ON" : "OFF") << "\n";
 
-  IMeshTools_Parameters aMeshParams;
-  aMeshParams.Deflection = aLinDeflection;
-  aMeshParams.Angle = aAngDeflection;
-  aMeshParams.Relative =  isRelative;
-  aMeshParams.InParallel = isInParallel;
-  aMeshParams.MinSize = aMinSize;
-  aMeshParams.InternalVerticesMode = isIntVertices;
-  aMeshParams.ControlSurfaceDeflection = isControlSurDef;
-  aMeshParams.AdjustMinSize = isAdjustMinSize;
-  
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
-  BRepMesh_IncrementalMesh aMesher (aShape, aMeshParams);
+  BRepMesh_IncrementalMesh aMesher;
+  aMesher.SetShape (aShape);
+  aMesher.ChangeParameters() = aMeshParams;
+
+  aMesher.Perform (aContext);
 
   di << "Meshing statuses: ";
-  Standard_Integer statusFlags = aMesher.GetStatusFlags();
-  if( !statusFlags )
+  const Standard_Integer aStatus = aMesher.GetStatusFlags();
+  if (!aStatus)
   {
     di << "NoError";
   }
   else
   {
     Standard_Integer i;
-    for( i = 0; i < 5; i++ )
+    for (i = 0; i < 9; i++)
     {
-      if( (statusFlags >> i) & (Standard_Integer)1 )
+      Standard_Integer aFlag = aStatus & (1 << i);
+      if (aFlag)
       {
-        switch(i+1)
+        switch ((IMeshData_Status) aFlag)
         {
-          case 1:
-            di << "OpenWire ";
-            break;
-          case 2:
-            di << "SelfIntersectingWire ";
-            break;
-          case 3:
-            di << "Failure ";
-            break;
-          case 4:
-            di << "ReMesh ";
-            break;
-          case 5:
-            di << "UserBreak";
-            break;
+        case IMeshData_OpenWire:
+          di << "OpenWire ";
+          break;
+        case IMeshData_SelfIntersectingWire:
+          di << "SelfIntersectingWire ";
+          break;
+        case IMeshData_Failure:
+          di << "Failure ";
+          break;
+        case IMeshData_ReMesh:
+          di << "ReMesh ";
+          break;
+        case IMeshData_UnorientedWire:
+          di << "UnorientedWire ";
+          break;
+        case IMeshData_TooFewPoints:
+          di << "TooFewPoints ";
+          break;
+        case IMeshData_Outdated:
+          di << "Outdated ";
+          break;
+        case IMeshData_Reused:
+          di << "Reused ";
+          break;
+        case IMeshData_UserBreak:
+          di << "User break";
+          break;
+        case IMeshData_NoError:
+        default:
+          break;
         }
       }
     }
@@ -245,7 +265,7 @@ static Standard_Integer tessellate (Draw_Interpretor& /*di*/, Standard_Integer n
 {
   if (nbarg != 5)
   {
-    std::cerr << "Builds regular triangulation with specified number of triangles\n"
+    Message::SendFail() << "Builds regular triangulation with specified number of triangles\n"
                  "    Usage: tessellate result {surface|face} nbu nbv\n"
                  "    Triangulation is put into the face with natural bounds (result);\n"
                  "    it will have 2*nbu*nbv triangles and (nbu+1)*(nbv+1) nodes";
@@ -259,7 +279,7 @@ static Standard_Integer tessellate (Draw_Interpretor& /*di*/, Standard_Integer n
 
   if (aNbU <= 0 || aNbV <= 0)
   {
-    std::cerr << "Error: Arguments nbu and nbv must be both greater than 0\n";
+    Message::SendFail() << "Error: Arguments nbu and nbv must be both greater than 0";
     return 1;
   }
 
@@ -274,14 +294,14 @@ static Standard_Integer tessellate (Draw_Interpretor& /*di*/, Standard_Integer n
     TopoDS_Shape aShape = DBRep::Get(aSrcName);
     if (aShape.IsNull() || aShape.ShapeType() != TopAbs_FACE)
     {
-      std::cerr << "Error: " << aSrcName << " is not a face\n";
+      Message::SendFail() << "Error: " << aSrcName << " is not a face";
       return 1;
     }
     TopoDS_Face aFace = TopoDS::Face (aShape);
     aSurf = BRep_Tool::Surface (aFace);
     if (aSurf.IsNull())
     {
-      std::cerr << "Error: Face " << aSrcName << " has no surface\n";
+      Message::SendFail() << "Error: Face " << aSrcName << " has no surface";
       return 1;
     }
 
@@ -290,14 +310,14 @@ static Standard_Integer tessellate (Draw_Interpretor& /*di*/, Standard_Integer n
   if (Precision::IsInfinite (aUMin) || Precision::IsInfinite (aUMax) || 
       Precision::IsInfinite (aVMin) || Precision::IsInfinite (aVMax))
   {
-    std::cerr << "Error: surface has infinite parametric range, aborting\n";
+    Message::SendFail() << "Error: surface has infinite parametric range, aborting";
     return 1;
   }
 
   BRepBuilderAPI_MakeFace aFaceMaker (aSurf, aUMin, aUMax, aVMin, aVMax, Precision::Confusion());
   if (! aFaceMaker.IsDone())
   {
-    std::cerr << "Error: cannot build face with natural bounds, aborting\n";
+    Message::SendFail() << "Error: cannot build face with natural bounds, aborting";
     return 1;
   }
   TopoDS_Face aFace = aFaceMaker;
@@ -390,7 +410,6 @@ static Standard_Integer tessellate (Draw_Interpretor& /*di*/, Standard_Integer n
 //function : MemLeakTest
 //purpose  : 
 //=======================================================================
-
 static Standard_Integer MemLeakTest(Draw_Interpretor&, Standard_Integer /*nbarg*/, const char** /*argv*/)
 {
   for(int i=0;i<10000;i++)
@@ -406,554 +425,6 @@ static Standard_Integer MemLeakTest(Draw_Interpretor&, Standard_Integer /*nbarg*
   return 0;
 }
 
-//=======================================================================
-//function : triangule
-//purpose  : 
-//=======================================================================
-
-
-class BRepMesh_Couple
-{
-public:
-  BRepMesh_Couple() { myI1 = myI2 = 0; }
-  BRepMesh_Couple(const Standard_Integer I1,
-    const Standard_Integer I2)
-  { myI1 = I1; myI2 = I2; }
-
-  Standard_Integer myI1;
-  Standard_Integer myI2;
-};
-
-inline Standard_Boolean IsEqual(const BRepMesh_Couple& one,
-                                const BRepMesh_Couple& other)
-{
-  if (one.myI1 == other.myI1 &&
-    one.myI2 == other.myI2) return Standard_True;
-  else return Standard_False;
-}
-
-inline Standard_Integer HashCode(const BRepMesh_Couple& one,
-                                 const Standard_Integer Upper)
-{
-  return ::HashCode((one.myI1+one.myI2), Upper);
-}
-
-typedef NCollection_Map<BRepMesh_Couple> BRepMesh_MapOfCouple;
-
-
-static void AddLink(BRepMesh_MapOfCouple& aMap, 
-                    Standard_Integer v1,
-                    Standard_Integer v2)
-{
-  Standard_Integer i1 = v1;
-  Standard_Integer i2 = v2;
-  if(i1 > i2) {
-    i1 = v2;
-    i2 = v1;
-  }
-  aMap.Add(BRepMesh_Couple(i1,i2));
-}
-
-static void MeshStats(const TopoDS_Shape& theSape,
-                      Standard_Integer& theNbTri,
-                      Standard_Integer& theNbEdges,
-                      Standard_Integer& theNbNodes)
-{
-  theNbTri = 0;
-  theNbEdges = 0;
-  theNbNodes = 0;
-
-  Handle(Poly_Triangulation) T;
-  TopLoc_Location L;
-
-  for ( TopExp_Explorer ex(theSape, TopAbs_FACE); ex.More(); ex.Next()) {
-    TopoDS_Face F = TopoDS::Face(ex.Current());
-    T = BRep_Tool::Triangulation(F, L);
-    if (!T.IsNull()) {
-      theNbTri += T->NbTriangles();
-      theNbNodes += T->NbNodes();
-
-      BRepMesh_MapOfCouple aMap;
-      //count number of links
-      Poly_Array1OfTriangle& Trian = T->ChangeTriangles();
-      for(Standard_Integer i = 1; i<=Trian.Length();i++) {
-        Standard_Integer v1, v2, v3;
-        Trian(i).Get(v1,v2,v3);
-
-        AddLink(aMap, v1, v2);
-        AddLink(aMap, v2, v3);
-        AddLink(aMap, v3, v1);
-      }
-
-      theNbEdges+=aMap.Extent();
-    }
-  }
-}
-
-static Standard_Integer triangule(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
-{
-  if (nbarg < 4)
-    return 1;
-
-  const char *id1 = argv[2];
-  TopoDS_Shape aShape = DBRep::Get(id1);
-  if (aShape.IsNull())
-    return 1;
-
-  di << argv[1] << " ";
-
-  Standard_Real aDeflection = Draw::Atof(argv[3]);
-  if (aDeflection <= 0.)
-  {
-    di << " Incorrect value of deflection!\n";
-    return 1;
-  }
-
-  Handle(MeshTest_DrawableMesh) aDMesh = 
-    new MeshTest_DrawableMesh(aShape, aDeflection);
-
-  Draw::Set(argv[1], aDMesh);
-
-  Standard_Integer nbn, nbl, nbe;
-  MeshStats(aShape, nbe, nbl, nbn);
-
-  di<<"(Resultat ("<<nbe<<" mailles) ("<<nbl<<" aretes) ("<<nbn<<" sommets))\n";
-
-  // passe de verification du maillage.
-  /*Standard_Integer nbc;
-  for (Standard_Integer iLi=1; iLi<= DM->Mesh()->NbEdges(); iLi++) {
-  const BRepMesh_Edge& ed=DM->Mesh()->Edge(iLi);
-  if (ed.Movability()!=BRepMesh_Deleted) {
-  nbc=struc->ElemConnectedTo(iLi).Extent();
-  if (nbc != 1 && nbc != 2) di <<"ERROR MAILLAGE Edge no "<< iLi<<"\n";
-  }
-  }*/
-
-
-  Bnd_Box aBox;
-
-  TopExp_Explorer aFaceIt(aShape, TopAbs_FACE);
-  for (; aFaceIt.More(); aFaceIt.Next())
-  {
-    const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
-
-    TopLoc_Location aLoc = aFace.Location();
-    Handle(Poly_Triangulation) aTriangulation =
-      BRep_Tool::Triangulation(aFace, aLoc);
-
-    if (!aTriangulation.IsNull())
-    {
-      const Standard_Integer    aLength = aTriangulation->NbNodes();
-      const TColgp_Array1OfPnt& aNodes  = aTriangulation->Nodes();
-      for (Standard_Integer i = 1; i <= aLength; ++i)
-        aBox.Add(aNodes(i));
-    }
-  }
-
-  Standard_Real aDelta = 0.;
-  if (!aBox.IsVoid())
-  {
-    Standard_Real x, y, z, X, Y, Z;
-    aBox.Get(x, y, z, X, Y, Z);
-
-    aDelta = Max(X - x, Max(Y - y, Z - z));
-    if (aDelta > 0.0)
-      aDelta = aDeflection / aDelta;
-  }
-
-  di << " Ratio between deflection and total shape size is " << aDelta << "\n";
-
-  return 0;
-}
-
-//=======================================================================
-//function : addshape
-//purpose  : 
-//=======================================================================
-
-Standard_Integer addshape(Draw_Interpretor&, Standard_Integer n, const char** a)
-{
-  if (n < 3) return 1;
-  Handle(MeshTest_DrawableMesh) D =
-    Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
-  if (D.IsNull()) return 1;
-  TopoDS_Shape S = DBRep::Get(a[2]);
-  if (S.IsNull()) return 1;
-
-  D->Add(S);
-  Draw::Repaint();
-
-  return 0;
-}
-
-
-//=======================================================================
-//function : smooth
-//purpose  : 
-//=======================================================================
-
-/*Standard_Integer smooth(Draw_Interpretor&, Standard_Integer n, const char** a)
-{
-if (n < 2) return 1;
-Handle(MeshTest_DrawableMesh) D =
-Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
-if (D.IsNull()) return 1;
-Handle(BRepMesh_DataStructureOfDelaun) struc=
-D->Mesh()->Result();
-BRepMesh_Array1OfVertexOfDelaun toto(1,1);
-BRepMesh_Delaun trial(struc, 
-toto,
-Standard_True);
-trial.SmoothMesh(0.1);
-Draw::Repaint();
-return 0;
-}
-*/
-
-//=======================================================================
-//function : edges
-//purpose  : 
-//=======================================================================
-
-/*static Standard_Integer edges (Draw_Interpretor&, Standard_Integer n, const char** a)
-{
-if (n < 3) return 1;
-
-Handle(MeshTest_DrawableMesh) D =
-Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
-if (D.IsNull()) return 1;
-TopoDS_Shape S = DBRep::Get(a[2]);
-if (S.IsNull()) return 1;
-
-TopExp_Explorer ex;
-TColStd_SequenceOfInteger& eseq = D->Edges();
-Handle(BRepMesh_FastDiscret) M = D->Mesh();
-Handle(BRepMesh_DataStructureOfDelaun) DS = M->Result();
-Standard_Integer e1, e2, e3, iTri;
-Standard_Boolean o1, o2, o3;
-
-// the faces
-for (ex.Init(S,TopAbs_FACE);ex.More();ex.Next()) {
-const BRepMesh_MapOfInteger& elems = DS->ElemOfDomain();
-BRepMesh_MapOfInteger::Iterator it;
-for (it.Initialize(elems); it.More(); it.Next()) {
-iTri = it.Key();
-const BRepMesh_Triangle& triang = M->Triangle(iTri);
-if (triang.Movability()!=BRepMesh_Deleted) {
-triang.Edges(e1, e2, e3, o1, o2, o3);
-eseq.Append(e1);
-eseq.Append(e2);
-eseq.Append(e3);
-}
-}
-}
-
-// the edges
-//for (ex.Init(S,TopAbs_EDGE,TopAbs_FACE);ex.More();ex.Next()) {
-//}
-
-Draw::Repaint();
-return 0;
-}
-*/
-
-//=======================================================================
-//function : vertices
-//purpose  : 
-//=======================================================================
-static Standard_Integer vertices(
-  Draw_Interpretor& /*di*/, 
-  Standard_Integer  /*argc*/, 
-  const char**      /*argv*/)
-{
-  return 0;
-
-  // TODO: OAN re-implement this command according changes in BRepMesh
-  //if (argc < 3)
-  //  return 1;
-
-  //Handle(MeshTest_DrawableMesh) aDrawableMesh =
-  //  Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(argv[1]));
-  //if (aDrawableMesh.IsNull())
-  //  return 1;
-
-  //TopoDS_Shape aShape = DBRep::Get(argv[2]);
-  //if (aShape.IsNull())
-  //  return 1;
-
-  //TColStd_SequenceOfInteger&   aVertexSeq = aDrawableMesh->Vertices();
-  //Handle(BRepMesh_FastDiscret) aMesh      = aDrawableMesh->Mesh();
-
-  //TopExp_Explorer aFaceIt(aShape, TopAbs_FACE);
-  //for (; aFaceIt.More(); aFaceIt.Next())
-  //{
-  //  const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
-
-  //  Handle(BRepMesh_FaceAttribute) aAttribute;
-  //  if (aMesh->GetFaceAttribute(aFace, aAttribute))
-  //  {
-  //    Handle(BRepMesh_DataStructureOfDelaun) aStructure = aAttribute->EditStructure();
-
-  //    // Recuperate from the map of edges.
-  //    const BRepMeshCol::MapOfInteger& aEdgeMap = aStructure->LinksOfDomain();
-
-  //    // Iterator on edges.
-  //    BRepMeshCol::MapOfInteger aVertices;
-  //    BRepMeshCol::MapOfInteger::Iterator aEdgeIt(aEdgeMap);
-  //    for (; aEdgeIt.More(); aEdgeIt.Next())
-  //    {
-  //      const BRepMesh_Edge& aEdge = aStructure->GetLink(aEdgeIt.Key());
-  //      aVertices.Add(aEdge.FirstNode());
-  //      aVertices.Add(aEdge.LastNode());
-  //    }
-
-  //    BRepMeshCol::MapOfInteger::Iterator anIt(vtx);
-  //    for ( ; anIt.More(); anIt.Next() )
-  //      aVertexSeq.Append(anIt.Key());
-  //  }
-  //}
-
-  //Draw::Repaint();
-  //return 0;
-}
-
-//=======================================================================
-//function : medge
-//purpose  : 
-//=======================================================================
-
-static Standard_Integer medge (Draw_Interpretor&, Standard_Integer n, const char** a)
-{
-  if (n < 3) return 1;
-
-  Handle(MeshTest_DrawableMesh) D =
-    Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
-  if (D.IsNull()) return 1;
-
-  Standard_Integer i,j,e;
-  TColStd_SequenceOfInteger& eseq = D->Edges();
-  for (i = 2; i < n; i++) {
-    e = Draw::Atoi(a[i]);
-    if (e > 0)
-      eseq.Append(e);
-    else if (e < 0) {
-      e = -e;
-      j = 1; 
-      while (j <= eseq.Length()) {
-        if (eseq(j) == e) 
-          eseq.Remove(j);
-        else
-          j++;
-      }
-    }
-    else
-      eseq.Clear();
-  }
-
-  Draw::Repaint();
-  return 0;
-}
-
-
-//=======================================================================
-//function : mvertex
-//purpose  : 
-//=======================================================================
-
-static Standard_Integer mvertex (Draw_Interpretor&, Standard_Integer n, const char** a)
-{
-  if (n < 3) return 1;
-
-  Handle(MeshTest_DrawableMesh) D =
-    Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
-  if (D.IsNull()) return 1;
-
-  Standard_Integer i,j,v;
-  TColStd_SequenceOfInteger& vseq = D->Vertices();
-  for (i = 2; i < n; i++) {
-    v = Draw::Atoi(a[i]);
-    if (v > 0)
-      vseq.Append(v);
-    else if (v < 0) {
-      v = -v;
-      j = 1;
-      while (j <= vseq.Length()) {
-        if (vseq(j) == v)
-          vseq.Remove(v);
-        else
-          j++;
-      }
-    }
-    else
-      vseq.Clear();
-  }
-  Draw::Repaint();
-  return 0;
-}
-
-
-//=======================================================================
-//function : triangle
-//purpose  : 
-//=======================================================================
-
-static Standard_Integer triangle (Draw_Interpretor&, Standard_Integer n, const char** a)
-{
-  if (n < 3) return 1;
-
-  Handle(MeshTest_DrawableMesh) D =
-    Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
-  if (D.IsNull()) return 1;
-
-  Standard_Integer i,j,v;
-  TColStd_SequenceOfInteger& tseq = D->Triangles();
-  for (i = 2; i < n; i++) {
-    v = Draw::Atoi(a[i]);
-    if (v > 0)
-      tseq.Append(v);
-    else if (v < 0) {
-      v = -v;
-      j = 1;
-      while (j <= tseq.Length()) {
-        if (tseq(j) == v)
-          tseq.Remove(v);
-        else
-          j++;
-      }
-    }
-    else
-      tseq.Clear();
-  }
-  Draw::Repaint();
-  return 0;
-}
-
-//=======================================================================
-//function : dumpvertex
-//purpose  : 
-//=======================================================================
-
-/*
-Standard_Integer dumpvertex(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-if (argc < 2) return 1;
-
-Handle(MeshTest_DrawableMesh) D =
-Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(argv[1]));
-if (D.IsNull()) return 1;
-
-Handle(BRepMesh_DataStructureOfDelaun) struc = D->Mesh()->Result();
-
-Standard_Integer in=1;
-if (argc>=3) {
-in=Draw::Atoi(argv[2]);
-in=Max(1,in);
-}
-Standard_Integer nbn=in;
-if (argc>=4) {
-nbn=Draw::Atoi(argv[3]);
-nbn=Min(nbn,struc->NbNodes());
-}
-
-for (; in<=nbn; in++) {
-BRepMesh_Vertex nod=struc->GetNode(in);
-di<<"(node "<<in<<" (uv "<<nod.Coord().X()
-<<" "<<nod.Coord().Y()<<") (3d "
-<<nod.Location3d()<<") ";
-printdegree(nod.Movability(), di);
-di<<" (edgeconex";
-BRepMesh_ListOfInteger::Iterator tati(struc->LinkNeighboursOf(in));
-for (; tati.More(); tati.Next()) di<<" "<<tati.Value();
-di << "))\n";
-}
-di <<"\n";
-return 0;
-}
-
-//=======================================================================
-//function : dumpedge
-//purpose  : 
-//=======================================================================
-
-Standard_Integer dumpedge(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-if (argc < 2) return 1;
-
-Handle(MeshTest_DrawableMesh) D =
-Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(argv[1]));
-if (D.IsNull()) return 1;
-
-Handle(BRepMesh_DataStructureOfDelaun) struc=D->Mesh()->Result();
-Standard_Integer il=1;
-if (argc>=3) {
-il=Draw::Atoi(argv[2]);
-il=Max(1, il);
-}
-Standard_Integer nbl=il;
-if (argc>=4) {
-nbl=Draw::Atoi(argv[3]);
-nbl=Min(nbl, struc->NbLinks());
-}
-
-for (; il<=nbl; il++) {
-BRepMesh_Edge edg=struc->GetLink(il);
-di << "(edge "<<il<<" ("<<edg.FirstNode()<<" "<<edg.LastNode()
-<<" ";
-printdegree(edg.Movability(), di);
-di<<") (triconex";
-const BRepMesh_PairOfIndex& pair = struc->ElemConnectedTo(il);
-for (Standard_Integer j = 1, jn = pair.Extent(); j <= jn; j++)
-di<<" "<<pair.Index(j);
-di << "))\n";
-}
-di <<"\n";
-return 0;
-}
-
-//=======================================================================
-//function : dumptriangle
-//purpose  : 
-//=======================================================================
-
-Standard_Integer dumptriangle(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-if (argc < 2) return 1;
-
-Handle(MeshTest_DrawableMesh) D =
-Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(argv[1]));
-if (D.IsNull()) return 1;
-
-Handle(BRepMesh_DataStructureOfDelaun) struc=D->Mesh()->Result();
-Standard_Integer ie=1;
-if (argc>=3) {
-ie=Draw::Atoi(argv[2]);
-ie=Max(1, ie);
-}
-Standard_Integer nbe=ie;
-if (argc>=4) {
-nbe=Draw::Atoi(argv[3]);
-nbe=Min(nbe, struc->NbElements());
-}
-
-Standard_Integer e1, e2, e3;
-Standard_Boolean o1, o2, o3;
-
-for (; ie<=nbe; ie++) {
-BRepMesh_Triangle tri=struc->GetElement(ie);
-tri.Edges(e1, e2, e3, o1, o2, o3); 
-if (o1) e1=-e1;
-if (o2) e2=-e2;
-if (o3) e3=-e3;
-di<<" (maille "<<ie<<" (links "<<e1<<" "
-<<e2<<" "<<e3<<")";
-printdegree(tri.Movability(), di);
-di<<")\n";
-}
-di << "\n";
-return 0;
-}
-*/
-
 //=======================================================================
 //function : trianglesinfo
 //purpose  : 
@@ -1051,7 +522,6 @@ static Standard_Integer trianglesinfo(Draw_Interpretor& di, Standard_Integer n,
 //function : veriftriangles
 //purpose  : 
 //=======================================================================
-
 static Standard_Integer veriftriangles(Draw_Interpretor& di, Standard_Integer n, const char** a)
 {
   if (n < 2) return 1;
@@ -1188,15 +658,11 @@ static Standard_Integer veriftriangles(Draw_Interpretor& di, Standard_Integer n,
   return 0;
 }
 
-
-
-
 //=======================================================================
 //function : tri2d
 //purpose  : 
 //=======================================================================
-
-Standard_Integer tri2d(Draw_Interpretor&, Standard_Integer n, const char** a)
+static Standard_Integer tri2d(Draw_Interpretor&, Standard_Integer n, const char** a)
 {
 
   if (n != 2) return 1;
@@ -1282,14 +748,10 @@ Standard_Integer tri2d(Draw_Interpretor&, Standard_Integer n, const char** a)
   return 0;
 }
 
-
-
-
 //=======================================================================
 //function : wavefront
 //purpose  : 
 //=======================================================================
-
 static Standard_Integer wavefront(Draw_Interpretor&, Standard_Integer nbarg, const char** argv)
 {
   if (nbarg < 2) return 1;
@@ -1398,7 +860,7 @@ static Standard_Integer wavefront(Draw_Interpretor&, Standard_Integer nbarg, con
         k1 = n1+totalnodes;
         k2 = n2+totalnodes;
         k3 = n3+totalnodes;
-        fprintf(outfile, "%s %d%s%d %d%s%d %d%s%d\n", "fo", k1,"//", k1, k2,"//", k2, k3,"//", k3);
+        fprintf(outfile, "f %d%s%d %d%s%d %d%s%d\n", k1,"//", k1, k2,"//", k2, k3,"//", k3);
       }
       nbpolygons += nbTriangles;
       totalnodes += nbNodes;
@@ -1414,153 +876,11 @@ static Standard_Integer wavefront(Draw_Interpretor&, Standard_Integer nbarg, con
   return 0;
 }
 
-
-//=======================================================================
-//function : onetriangulation
-//purpose  : 
-//=======================================================================
-
-Standard_Integer onetriangulation(Draw_Interpretor&, Standard_Integer /*nbarg*/, const char** /*argv*/)
-{
-
-  /*
-
-  if (nbarg < 2) return 1;
-
-  TopoDS_Shape S = DBRep::Get(argv[1]);
-  if (S.IsNull()) return 1;
-
-  Handle(Poly_Triangulation) TFinale;
-  char name[100];
-  Standard_Integer nbshell = 0;
-
-  TopExp_Explorer ex, exs, ex2;
-
-  for (ex.Init(S, TopAbs_SHELL); ex.More(); ex.Next()) {
-  nbshell++;
-  TopoDS_Shell Sh = TopoDS::Shell(ex.Current());
-
-  for (exs.Init(Sh, TopAbs_Face); exs.More(); exs.Next()) {
-  TopoDS_Face F = TopoDS::Face(exs.Current());
-  Handle(Poly_Triangulation) T = BRep_Tool::Triangulation(F, L);
-
-  for (ex2.Init(F, TopAbs_EDGE); ex2.More(); ex2.Next()) {
-  TopoDS_Edge edge = TopoDS::Edge(ex2.Current());
-  const TColgp_Array1OfPnt& Nodes = T->Nodes();
-  const Poly_Array1OfTriangle& triangles = T->Triangles();
-
-  if (mapedges.IsBound(edge)) {
-  const TColStd_ListOfTransient& L = edges.Find(edge);
-  const Handle(Poly_PolygonOnTriangulation)& P = 
-  *(Handle(Poly_PolygonOnTriangulation)*)&(L.First());
-  const TColStd_Array1OfInteger& NOD = P->Nodes();
-
-  }
-  }
-  }
-
-  Sprintf(name, "%s_%i", "tr", nbshell);
-  DrawTrSurf::Set(name, TFinale);
-
-  }
-
-  */
-  return 0;
-}
-
-
-#if 0
-
-//=======================================================================
-//function : vb
-//purpose  : 
-//=======================================================================
-
-Standard_Integer vb(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
-{
-  Standard_Integer NbPoints = 1, Deg = 1;
-
-  for (Deg = 1; Deg <= 25; Deg++) {
-    for (NbPoints = 1; NbPoints <= 24; NbPoints++) {
-
-      math_Vector GaussP(1, NbPoints), GaussW(1, NbPoints);
-      math_Vector TheWeights(1, NbPoints), VBParam(1, NbPoints);
-      math_Matrix VB(1, Deg+1, 1, NbPoints);
-
-      math::GaussPoints(NbPoints, GaussP);
-
-      Standard_Integer i, j, classe = Deg+1, cl1 = Deg;
-
-      // calcul et mise en ordre des parametres et des poids:
-      for (i = 1; i <= NbPoints; i++) {
-        if (i <=  (NbPoints+1)/2) {
-          VBParam(NbPoints-i+1)  = 0.5*(1 + GaussP(i));
-        }
-        else {
-          VBParam(i-(NbPoints+1)/2)  = 0.5*(1 + GaussP(i));
-        }
-      }
-
-
-      // Calcul du VB (Valeur des fonctions de Bernstein):
-      for (i = 1; i <= classe; i++) {
-        for (j = 1; j <= NbPoints; j++) {
-          VB(i,j)=PLib::Binomial(cl1,i-1)*Pow((1-VBParam(j)),classe-i)*Pow(VBParam(j),i-1);
-        }
-      }
-
-
-      for (i = 1; i <= classe; i++) {
-        for (j = 1; j <= NbPoints; j++) {
-          di<< VB(i, j) << ", ";
-        }
-      }
-      di << "\n\n";
-    }
-  }
-  return 0;
-}  
-//=======================================================================
-//function : extrema
-//purpose  : 
-//=======================================================================
-
-Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
-{
-
-
-  Handle(Geom_Curve) C = DrawTrSurf::GetCurve(argv[1]);
-
-  Standard_Real X, Y, Z, U0;
-  X = Draw::Atof(argv[2]);
-  Y = Draw::Atof(argv[3]);
-  Z = Draw::Atof(argv[4]);
-  U0 = Draw::Atof(argv[5]);
-
-  gp_Pnt P(X, Y, Z);
-  GeomAdaptor_Curve GC(C);
-  Standard_Real tol = 1.e-09;
-  Extrema_LocateExtPC ext(P, GC, U0, tol);
-
-  if (ext.IsDone()) {
-    gp_Pnt P1 = ext.Point().Value();
-    di <<"distance =  "<<ext.Value() << "\n";
-    di <<"point =     "<<P1.X()<<" "<<P1.Y()<<" "<< P1.Z()<< "\n";
-    di <<"parametre = "<<ext.Point().Parameter()<<"\n";
-  }
-
-  return 0;
-}
-
-#endif
-
-
 //=======================================================================
 //function : triedgepoints
 //purpose  : 
 //=======================================================================
-
-Standard_Integer triedgepoints(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
+static Standard_Integer triedgepoints(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
 {
   if( nbarg < 2 )
     return 1;
@@ -1632,9 +952,9 @@ Standard_Integer triedgepoints(Draw_Interpretor& di, Standard_Integer nbarg, con
 //function : correctnormals
 //purpose  : Corrects normals in shape triangulation nodes (...)
 //=======================================================================
-Standard_Integer correctnormals (Draw_Interpretor& theDI, 
-                            Standard_Integer /*theNArg*/, 
-                            const char** theArgVal)
+static Standard_Integer correctnormals(Draw_Interpretor& theDI,
+                                       Standard_Integer /*theNArg*/,
+                                       const char** theArgVal)
 {
   TopoDS_Shape S = DBRep::Get(theArgVal[1]);
 
@@ -1668,29 +988,12 @@ void  MeshTest::Commands(Draw_Interpretor& theCommands)
   theCommands.Add("incmesh","Builds triangular mesh for the shape, run w/o args for help",__FILE__, incrementalmesh, g);
   theCommands.Add("tessellate","Builds triangular mesh for the surface, run w/o args for help",__FILE__, tessellate, g);
   theCommands.Add("MemLeakTest","MemLeakTest",__FILE__, MemLeakTest, g);
-  theCommands.Add("mesh","mesh result Shape deflection",__FILE__, triangule, g);
-  theCommands.Add("addshape","addshape meshname Shape [deflection]",__FILE__, addshape, g);
-  //theCommands.Add("smooth","smooth meshname",__FILE__, smooth, g);
-  //theCommands.Add("edges","edges mesh shape, highlight the edges",__FILE__,edges, g);
-  theCommands.Add("vertices","vertices mesh shape, highlight the vertices",__FILE__,vertices, g);
-  theCommands.Add("medge","medge mesh [-]index (0 to clear all)",__FILE__,medge, g);
-  theCommands.Add("mvertex","mvertex mesh [-]index (0 to clear all)",__FILE__,mvertex, g);
-  theCommands.Add("triangle","triangle mesh [-]index (0 to clear all)",__FILE__,triangle, g);
-  //theCommands.Add("dumpvertex","dumpvertex mesh [index]",__FILE__,dumpvertex, g);
-  //theCommands.Add("dumpedge","dumpedge mesh [index]",__FILE__,dumpedge, g);
-  //theCommands.Add("dumptriangle","dumptriangle mesh [index]",__FILE__,dumptriangle, g);
 
   theCommands.Add("tri2d", "tri2d facename",__FILE__, tri2d, g);
   theCommands.Add("trinfo","trinfo name, print triangles information on objects",__FILE__,trianglesinfo,g);
   theCommands.Add("veriftriangles","veriftriangles name, verif triangles",__FILE__,veriftriangles,g);
   theCommands.Add("wavefront","wavefront name",__FILE__, wavefront, g);
-  theCommands.Add("onetriangulation","onetriangulation name",__FILE__, onetriangulation, g);
   theCommands.Add("triepoints", "triepoints shape1 [shape2 ...]",__FILE__, triedgepoints, g);
 
   theCommands.Add("correctnormals", "correctnormals shape",__FILE__, correctnormals, g);
-
-#if 0
-  theCommands.Add("extrema","extrema ",__FILE__, extrema, g);
-  theCommands.Add("vb","vb ",__FILE__, vb, g);
-#endif
 }
index c0887c65f17766f293b0a12b4d2733a5ebe4a659..5c3b92ba5f7389dfee235e15cd1ed24a17ac2fb1 100644 (file)
 #include <Poly_Triangulation.hxx>
 #include <Poly_PolygonOnTriangulation.hxx>
 #include <Poly_Connect.hxx>
+#include <Precision.hxx>
+
+//=======================================================================
+//function : ComputeArea
+//purpose  : Computes area of the triangle given by its three points (either 2D or3D)
+//=======================================================================
+static Standard_Real ComputeArea(const gp_XYZ& theP1,
+                                 const gp_XYZ& theP2,
+                                 const gp_XYZ& theP3)
+{
+  return 0.5*(theP3 - theP1).Crossed(theP2 - theP1).Modulus();
+}
+
+//=======================================================================
+//function : ComputeArea
+//purpose  : Computes area of the triangle given by its three points (either 2D or3D)
+//=======================================================================
+static Standard_Real ComputeArea(const gp_XY& theP1,
+                                 const gp_XY& theP2,
+                                 const gp_XY& theP3)
+{
+  return 0.5*Abs((theP3 - theP1).Crossed(theP2 - theP1));
+}
 
 //=======================================================================
 //function : Perform
@@ -57,7 +80,7 @@ void MeshTest_CheckTopology::Perform (Draw_Interpretor& di)
       BRep_Tool::PolygonOnTriangulation(aEdge, aT1, aLoc1);
     if (aPoly1.IsNull() || aT1.IsNull()) {
 #ifdef OCCT_DEBUG
-      cout<<"problem getting PolygonOnTriangulation of edge "<<ie<<endl;
+      std::cout<<"problem getting PolygonOnTriangulation of edge "<<ie<<std::endl;
 #endif
       continue;
     }
@@ -74,7 +97,7 @@ void MeshTest_CheckTopology::Perform (Draw_Interpretor& di)
        BRep_Tool::PolygonOnTriangulation(aEdge, aT2, aLoc2);
       if (aPoly2.IsNull() || aT2.IsNull()) {
 #ifdef OCCT_DEBUG
-       cout<<"problem getting PolygonOnTriangulation of edge "<<ie<<endl;
+       std::cout<<"problem getting PolygonOnTriangulation of edge "<<ie<<std::endl;
 #endif
        continue;
       }
@@ -87,25 +110,27 @@ void MeshTest_CheckTopology::Perform (Draw_Interpretor& di)
       }
 
       // check distances between corresponding points
-      Standard_Real aDefle = Max(aT1->Deflection(), aT2->Deflection());
+      Standard_Real aSqDefle = BRep_Tool::Tolerance(aEdge);
+      aSqDefle *= aSqDefle;
       const TColgp_Array1OfPnt& aPoints1 = aT1->Nodes();
       const TColgp_Array1OfPnt& aPoints2 = aT2->Nodes();
       Standard_Integer iF1 = aMapF.FindIndex(aFace1);
       Standard_Integer iF2 = aMapF.FindIndex(aFace2);
       Standard_Integer i1 = aNodes1.Lower();
       Standard_Integer i2 = aNodes2.Lower();
-      gp_Trsf aTrsf1 = aFace1.Location().Transformation();
-      gp_Trsf aTrsf2 = aFace2.Location().Transformation();
+      const gp_Trsf &aTrsf1 = aFace1.Location().Transformation();
+      const gp_Trsf &aTrsf2 = aFace2.Location().Transformation();
       for (; i1 <= aNodes1.Upper(); i1++, i2++) {
-       gp_Pnt aP1 = aPoints1(aNodes1(i1)).Transformed(aTrsf1);
-       gp_Pnt aP2 = aPoints2(aNodes2(i2)).Transformed(aTrsf2);
-       Standard_Real aDist = aP1.Distance(aP2);
-       if (aDist > aDefle) {
+       const gp_Pnt aP1 = aPoints1(aNodes1(i1)).Transformed(aTrsf1);
+       const gp_Pnt aP2 = aPoints2(aNodes2(i2)).Transformed(aTrsf2);
+       const Standard_Real aSqDist = aP1.SquareDistance(aP2);
+        if (aSqDist > aSqDefle)
+        {
          myErrors.Append(iF1);
          myErrors.Append(i1);
          myErrors.Append(iF2);
          myErrors.Append(i2);
-         myErrorsVal.Append(aDist);
+          myErrorsVal.Append(Sqrt(aSqDist));
        }
       }
     }
@@ -122,6 +147,8 @@ void MeshTest_CheckTopology::Perform (Draw_Interpretor& di)
       continue;
     }
 
+    const gp_Trsf &aTrsf = aLoc.Transformation();
+
     // remember boundary nodes
     TColStd_PackedMapOfInteger aMapBndNodes;
     TopExp_Explorer ex(aFace, TopAbs_EDGE);
@@ -149,6 +176,29 @@ void MeshTest_CheckTopology::Perform (Draw_Interpretor& di)
       aUsedNodes.Add (n[1]);
       aUsedNodes.Add (n[2]);
 
+      const gp_Pnt aPts[3] = {aT->Node(n[0]).Transformed(aTrsf),
+                              aT->Node(n[1]).Transformed(aTrsf),
+                              aT->Node(n[2]).Transformed(aTrsf)};
+
+      Standard_Real anArea = ComputeArea(aPts[0].XYZ(), aPts[1].XYZ(), aPts[2].XYZ());
+      if (anArea < Precision::SquareConfusion())
+      {
+        mySmallTrianglesFaces.Append(iF);
+        mySmallTrianglesTriangles.Append(i);
+      }
+      else if (aT->HasUVNodes())
+      {
+        const gp_XY aPUV[3] = {aT->UVNode(n[0]).XY(),
+                               aT->UVNode(n[1]).XY(),
+                               aT->UVNode(n[2]).XY()};
+        anArea = ComputeArea(aPUV[0], aPUV[1], aPUV[2]);
+        if (anArea < Precision::SquarePConfusion())
+        {
+          mySmallTrianglesFaces.Append(iF);
+          mySmallTrianglesTriangles.Append(i);
+        }
+      }
+
       aConn.Triangles(i, t[0], t[1], t[2]);
       for (j = 0; j < 3; j++) {
        if (t[j] == 0) {
index a3e5e6574387dc7d6b1ea7dd6e5e92957c1f20c5..73aa75cb6e5045c094d1fa6d2335a50d47ac2c38 100644 (file)
@@ -101,6 +101,23 @@ public:
     theNodeNum = myFreeNodeNums(theIndex);
   }
 
+  //! Returns number of triangles with null area
+  Standard_Integer NbSmallTriangles() const
+  {
+    return mySmallTrianglesFaces.Length();
+  }
+
+  //! returns the number of face containing the Index-th detected 
+  //! small triangle and number of the problematic triangle in
+  //! this face.
+  void GetSmallTriangle(const Standard_Integer theIndex,
+                        Standard_Integer& theFaceNum,
+                        Standard_Integer& theNodeNum) const
+  {
+    theFaceNum = mySmallTrianglesFaces(theIndex);
+    theNodeNum = mySmallTrianglesTriangles(theIndex);
+  }
+
 private:
   TopoDS_Shape myShape;
   NCollection_IndexedDataMap<Standard_Integer,Handle(TColStd_HSequenceOfInteger)>
@@ -112,6 +129,9 @@ private:
   TColStd_SequenceOfInteger myAsyncEdges;
   TColStd_SequenceOfInteger myFreeNodeFaces;
   TColStd_SequenceOfInteger myFreeNodeNums;
+  TColStd_SequenceOfInteger mySmallTrianglesFaces;
+  TColStd_SequenceOfInteger mySmallTrianglesTriangles;
+
 };
 
 #endif
index ee2b132be57bc7a64a71d8efc97d934e6cdb0ecc..1118d11bca794a5c2416f97a7705b4568f0e3ed6 100644 (file)
@@ -19,6 +19,9 @@
 #include <TCollection_AsciiString.hxx>
 #include <TColgp_Array1OfPnt.hxx>
 #include <Poly_Polygon3D.hxx>
+#include <BRepMesh_Edge.hxx>
+#include <BRepMesh_Vertex.hxx>
+#include <BRepMesh_Triangle.hxx>
 #include <BRepMesh_DataStructureOfDelaun.hxx>
 
 // This file defines global functions not declared in any public header,
@@ -51,8 +54,8 @@ Standard_EXPORT const char* MeshTest_DrawLinks(const char* theNameStr, void* the
       const BRepMesh_Vertex& aV1 = aMeshData->GetNode(n1);
       const BRepMesh_Vertex& aV2 = aMeshData->GetNode(n2);
       Handle(Draw_Segment3D) aSeg = new Draw_Segment3D(gp_Pnt(aV1.Coord().X(), aV1.Coord().Y(), 0),
-        gp_Pnt(aV2.Coord().X(), aV2.Coord().Y(), 0),
-        Draw_bleu);
+                                                       gp_Pnt(aV2.Coord().X(), aV2.Coord().Y(), 0), 
+                                                       Draw_bleu);
       Draw::Set((aName + "_" + i).ToCString(), aSeg);
     }
     return theNameStr;
@@ -74,7 +77,7 @@ Standard_EXPORT const char* MeshTest_DrawTriangles(const char* theNameStr, void*
     return "Error: name or face attribute is null";
   }
   try {
-    const Handle(BRepMesh_DataStructureOfDelaun)& aMeshData =
+    const Handle(BRepMesh_DataStructureOfDelaun)& aMeshData = 
       *(Handle(BRepMesh_DataStructureOfDelaun)*)theDataStruct;
 
     if (aMeshData.IsNull())
diff --git a/src/MeshTest/MeshTest_DrawableMesh.cxx b/src/MeshTest/MeshTest_DrawableMesh.cxx
deleted file mode 100644 (file)
index 7a1a574..0000000
+++ /dev/null
@@ -1,315 +0,0 @@
-// Created on: 1994-08-03
-// Created by: Modeling
-// Copyright (c) 1994-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <MeshTest_DrawableMesh.hxx>
-#include <TopoDS.hxx>
-#include <Draw.hxx>
-#include <Draw_ColorKind.hxx>
-#include <Draw_Color.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <Poly_Triangulation.hxx>
-#include <Standard_RangeError.hxx>
-#include <BRepMesh_DegreeOfFreedom.hxx>
-#include <BRepMesh_Edge.hxx>
-#include <BRepMesh_Vertex.hxx>
-#include <BRepMesh_Triangle.hxx>
-#include <BRepMesh_DataStructureOfDelaun.hxx>
-#include <TopExp_Explorer.hxx>
-#include <BRep_Tool.hxx>
-
-
-IMPLEMENT_STANDARD_RTTIEXT(MeshTest_DrawableMesh,Draw_Drawable3D)
-
-typedef NCollection_Map<BRepMesh_Edge> BRepMesh_MapOfLinks;
-
-static inline void addLink(const Standard_Integer theIndex1,
-                           const Standard_Integer theIndex2,
-                           BRepMesh_MapOfLinks&   theMap)
-{
-  BRepMesh_Edge anEdge(theIndex1, theIndex2, BRepMesh_Free);
-  theMap.Add(anEdge);
-}
-
-//=======================================================================
-//function : MeshTest_DrawableMesh
-//purpose  : 
-//=======================================================================
-MeshTest_DrawableMesh::MeshTest_DrawableMesh()
-  : myDeflection(1.)
-{
-}
-
-//=======================================================================
-//function : MeshTest_DrawableMesh
-//purpose  : 
-//=======================================================================
-MeshTest_DrawableMesh::MeshTest_DrawableMesh(const TopoDS_Shape& theShape,
-                                             const Standard_Real theDeflection)
-  : myDeflection(theDeflection)
-{
-  Add(theShape);
-}
-
-//=======================================================================
-//function : MeshTest_DrawableMesh
-//purpose  : 
-//=======================================================================
-MeshTest_DrawableMesh::MeshTest_DrawableMesh(
-  const Handle(BRepMesh_IncrementalMesh)& theMesher)
-  : myDeflection(1.)
-{
-  myMesher = theMesher;
-  if (!myMesher.IsNull())
-    myDeflection = myMesher->Parameters().Deflection;
-}
-
-//=======================================================================
-//function : MeshTest_DrawableMesh
-//purpose  : 
-//=======================================================================
-void MeshTest_DrawableMesh::Add(const TopoDS_Shape& theShape)
-{
-  if (myMesher.IsNull())
-  {
-    myMesher = new BRepMesh_IncrementalMesh;
-    myMesher->ChangeParameters().Deflection = myDeflection;
-    myMesher->ChangeParameters().Angle = 0.5;
-  }
-  
-  myMesher->SetShape(theShape);
-  myMesher->Perform();
-}
-
-//=======================================================================
-//function : DrawOn
-//purpose  : 
-//=======================================================================
-
-void MeshTest_DrawableMesh::DrawOn(Draw_Display& /*D*/) const 
-{
-  // should be reimplemented!!
-  /*  Handle(BRepMesh_DataStructureOfDelaun) struc = myMesh->Result();
-  Standard_Integer nbc;
-  D.SetColor(Draw_vert);
-
-  for (Standard_Integer iLi=1; iLi<=myMesh->NbEdges(); iLi++) {
-  const BRepMesh_Edge& ed=myMesh->Edge(iLi);
-  if (ed.Movability()!=BRepMesh_Deleted) {
-  nbc=struc->ElemConnectedTo(iLi).Extent();
-  if (nbc<=0) D.SetColor(Draw_bleu);
-  else if (nbc==1) D.SetColor(Draw_jaune);
-  else if (nbc==2) D.SetColor(Draw_vert);
-  else D.SetColor(Draw_corail);
-  D.MoveTo(myMesh->Pnt(ed.FirstNode()));
-  D.DrawTo(myMesh->Pnt(ed.LastNode()));
-  }
-  }
-
-
-  // highlighted triangles
-  D.SetColor(Draw_blanc);
-  Standard_Integer e1, e2, e3, i;
-  Standard_Boolean o1, o2, o3;
-
-  for (i = 1; i <= myTriangles.Length(); i++) {
-  const BRepMesh_Triangle& tri=struc->GetElement(myTriangles(i));
-  tri.Edges(e1, e2, e3, o1, o2, o3); 
-  const BRepMesh_Edge& ed1=myMesh->Edge(e1);
-  if (ed1.Movability()!=BRepMesh_Deleted) {
-  D.MoveTo(myMesh->Pnt(ed1.FirstNode()));
-  D.DrawTo(myMesh->Pnt(ed1.LastNode()));
-  }
-  const BRepMesh_Edge& ed2=myMesh->Edge(e2);
-  if (ed2.Movability()!=BRepMesh_Deleted) {
-  D.MoveTo(myMesh->Pnt(ed2.FirstNode()));
-  D.DrawTo(myMesh->Pnt(ed2.LastNode()));
-  }
-  const BRepMesh_Edge& ed3=myMesh->Edge(e3);
-  if (ed3.Movability()!=BRepMesh_Deleted) {
-  D.MoveTo(myMesh->Pnt(ed3.FirstNode()));
-  D.DrawTo(myMesh->Pnt(ed3.LastNode()));
-  }
-  }
-
-  // highlighted edges
-  D.SetColor(Draw_rouge);
-  for (i = 1; i <= myEdges.Length(); i++) {
-  const BRepMesh_Edge& ed=myMesh->Edge(myEdges(i));
-  if (ed.Movability()!=BRepMesh_Deleted) {
-  D.MoveTo(myMesh->Pnt(ed.FirstNode()));
-  D.DrawTo(myMesh->Pnt(ed.LastNode()));
-  }
-  }
-
-  // highlighted vertices
-  for (i = 1; i <= myVertices.Length(); i++) {
-  D.DrawMarker(myMesh->Pnt(myVertices(i)),Draw_Losange);
-  }
-
-  */
-
-}
-
-//=======================================================================
-//function : Copy
-//purpose  : 
-//=======================================================================
-Handle(Draw_Drawable3D) MeshTest_DrawableMesh::Copy() const 
-{
-  return new MeshTest_DrawableMesh(myMesher);
-}
-
-//=======================================================================
-//function : Dump
-//purpose  : 
-//=======================================================================
-void MeshTest_DrawableMesh::Dump(Standard_OStream&) const 
-{
-  // Should be reimplemented
-
-  /*Handle(BRepMesh_DataStructureOfDelaun) struc=myMesh->Result();
-  Standard_Integer e1, e2, e3;
-  Standard_Boolean o1, o2, o3;
-  Standard_Integer in, il, ie;
-  Standard_Integer nbn=struc->NbNodes();
-  Standard_Integer nbl=struc->NbLinks();
-  Standard_Integer nbe=struc->NbElements();
-
-  for (in=1; in<=nbn; in++) {
-  BRepMesh_Vertex nod=struc->GetNode(in);
-  S<<"(node "<<in<<" (uv "<<nod.Coord().X()<<" "
-  <<nod.Coord().Y()<<") (3d "
-  <<nod.Location3d()<<") ";
-  printdegree(nod.Movability());
-  S<<" (edgeconex";
-  BRepMesh_ListOfInteger::Iterator tati(struc->LinkNeighboursOf(in));
-  for (; tati.More(); tati.Next()) S<<" "<<tati.Value();
-  S << "))\n";
-  }
-  S <<endl;
-  for (il=1; il<=nbl; il++) {
-  BRepMesh_Edge edg=struc->GetLink(il);
-  S << "(edge "<<il<<" ("<<edg.FirstNode()<<" "<<edg.LastNode()
-  <<" ";
-  printdegree(edg.Movability());
-  S<<") (triconex";
-  const BRepMesh_PairOfIndex& pair = struc->ElemConnectedTo(il);
-  for (Standard_Integer j = 1, jn = pair.Extent(); j <= jn; j++)
-  S<<" "<<pair.Index(j);
-  S << "))\n";
-  }
-  S <<endl;
-  for (ie=1; ie<=nbe; ie++) {
-  BRepMesh_Triangle tri=struc->GetElement(ie);
-  tri.Edges(e1, e2, e3, o1, o2, o3); 
-  if (!o1) e1=-e1;
-  if (!o2) e2=-e2;
-  if (!o3) e3=-e3;
-  S<<" (maille "<<ie<<" (links "<<e1<<" "
-  <<e2<<" "<<e3<<")";
-  printdegree(tri.Movability());
-  S<<")\n";
-  }
-  S << endl;
-  */
-}
-
-//=======================================================================
-//function : Whatis
-//purpose  : 
-//=======================================================================
-void MeshTest_DrawableMesh::Whatis(Draw_Interpretor& theStream) const 
-{
-  const TopoDS_Shape& aShape = myMesher->Shape();
-
-  Standard_Integer aPointsNb    = 0;
-  Standard_Integer aTrianglesNb = 0;
-  Standard_Integer aEdgesNb     = 0;
-
-  TopLoc_Location aLocation;
-  Handle(Poly_Triangulation) aTriangulation;
-
-  TopExp_Explorer aFaceIt(aShape, TopAbs_FACE);
-  for (; aFaceIt.More(); aFaceIt.Next())
-  {
-    const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
-
-    aTriangulation = BRep_Tool::Triangulation(aFace, aLocation);
-    if (aTriangulation.IsNull())
-      continue;
-
-    // Count number of links
-    BRepMesh_MapOfLinks aMap;
-    const Poly_Array1OfTriangle& aTriangles = aTriangulation->Triangles();
-    for (Standard_Integer i = 1, v[3]; i <= aTriangles.Length(); ++i)
-    {
-      aTriangles(i).Get(v[0], v[1], v[2]);
-
-      addLink(v[0], v[1], aMap);
-      addLink(v[1], v[2], aMap);
-      addLink(v[2], v[0], aMap);
-    }
-
-    aPointsNb    += aTriangulation->NbNodes();
-    aTrianglesNb += aTriangulation->NbTriangles();
-    aEdgesNb     += aMap.Extent();
-  }
-
-  theStream << " 3d mesh\n";
-  theStream << "    - Triangles : " << aTrianglesNb << "\n";
-  theStream << "    - Edges     : " << aEdgesNb     << "\n";
-  theStream << "    - Point3d   : " << aPointsNb    << "\n";
-}
-
-//=======================================================================
-//function : Mesher
-//purpose  : 
-//=======================================================================
-const Handle(BRepMesh_IncrementalMesh)& MeshTest_DrawableMesh::Mesher() const 
-{
-  return myMesher;
-}
-
-
-//=======================================================================
-//function : Edges
-//purpose  : 
-//=======================================================================
-TColStd_SequenceOfInteger& MeshTest_DrawableMesh::Edges()
-{
-  return myEdges;
-}
-
-
-//=======================================================================
-//function : Vertices
-//purpose  : 
-//=======================================================================
-TColStd_SequenceOfInteger& MeshTest_DrawableMesh::Vertices()
-{
-  return myVertices;
-}
-
-//=======================================================================
-//function : Triangles
-//purpose  : 
-//=======================================================================
-TColStd_SequenceOfInteger& MeshTest_DrawableMesh::Triangles()
-{
-  return myTriangles;
-}
-
diff --git a/src/MeshTest/MeshTest_DrawableMesh.hxx b/src/MeshTest/MeshTest_DrawableMesh.hxx
deleted file mode 100644 (file)
index c36a9c2..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2013-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _MeshTest_DrawableMesh_HeaderFile
-#define _MeshTest_DrawableMesh_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-#include <BRepMesh_IncrementalMesh.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <Draw_Drawable3D.hxx>
-#include <Standard_OStream.hxx>
-#include <Draw_Interpretor.hxx>
-
-class TopoDS_Shape;
-class Draw_Display;
-
-//! A drawable mesh. 
-//! Provides a mesh object inherited from Drawable3d to draw a triangulation.
-//! It contains a sequence of highlighted edges and highlighted vertices. <br>
-class MeshTest_DrawableMesh : public Draw_Drawable3D
-{
-public:
-  
-  Standard_EXPORT MeshTest_DrawableMesh();
-  
-  Standard_EXPORT MeshTest_DrawableMesh(const TopoDS_Shape& theShape,
-                                        const Standard_Real theDeflection);
-  
-  Standard_EXPORT MeshTest_DrawableMesh(const Handle(BRepMesh_IncrementalMesh)& theMesher);
-  
-  Standard_EXPORT void Add(const TopoDS_Shape& theShape);
-  
-  Standard_EXPORT TColStd_SequenceOfInteger& Edges();
-  
-  Standard_EXPORT TColStd_SequenceOfInteger& Vertices();
-  
-  Standard_EXPORT TColStd_SequenceOfInteger& Triangles();
-  
-  Standard_EXPORT void DrawOn(Draw_Display& theDisplay) const Standard_OVERRIDE;
-  
-  Standard_EXPORT virtual Handle(Draw_Drawable3D) Copy() const Standard_OVERRIDE;
-  
-  Standard_EXPORT virtual void Dump(Standard_OStream& theStream) const Standard_OVERRIDE;
-  
-  Standard_EXPORT virtual void Whatis(Draw_Interpretor& theDi) const Standard_OVERRIDE;
-  
-  Standard_EXPORT const Handle(BRepMesh_IncrementalMesh)& Mesher() const;
-
-  DEFINE_STANDARD_RTTIEXT(MeshTest_DrawableMesh,Draw_Drawable3D)
-
-private: 
-
-  Handle(BRepMesh_IncrementalMesh) myMesher;
-  Standard_Real                    myDeflection;
-  TColStd_SequenceOfInteger        myEdges;
-  TColStd_SequenceOfInteger        myVertices;
-  TColStd_SequenceOfInteger        myTriangles;
-};
-
-DEFINE_STANDARD_HANDLE(MeshTest_DrawableMesh, Draw_Drawable3D)
-
-#endif
index 0e8e5092381a9ebe8dd341ae798bd05cf7d3b5b1..f65194a5823f6721a55000ca705997a0395f71ca 100644 (file)
@@ -46,6 +46,8 @@
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <Geom2d_BSplineCurve.hxx>
 
 static Standard_Integer mpnames           (Draw_Interpretor& , Standard_Integer , const char** );
 static Standard_Integer mpsetdefaultname  (Draw_Interpretor& , Standard_Integer , const char** );
@@ -82,7 +84,8 @@ void MeshTest::PluginCommands(Draw_Interpretor& theCommands)
   theCommands.Add("mpparallel"       , "mpparallel [toTurnOn] : show / set multi-threading flag for incremental mesh",
     __FILE__, mpparallel, g);
   theCommands.Add("triarea","shape [eps]  (computes triangles and surface area)",__FILE__, triarea, g);
-  theCommands.Add("tricheck", "shape   (checks triangulation of shape)", __FILE__, tricheck, g);
+  theCommands.Add("tricheck", "shape [-small]  (checks triangulation of shape);\n"
+                  "\"-small\"-option allows finding triangles with small area", __FILE__, tricheck, g);
 }
 
 //=======================================================================
@@ -297,7 +300,7 @@ static Standard_Integer triarea (Draw_Interpretor& di, int n, const char ** a)
       TopLoc_Location aLoc;
       Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc);
       if (aPoly.IsNull()) {
-        cout << "face "<<i<<" has no triangulation"<<endl;
+        std::cout << "face "<<i<<" has no triangulation"<<std::endl;
         continue;
       }
       const Poly_Array1OfTriangle& triangles = aPoly->Triangles();
@@ -343,9 +346,11 @@ static Standard_Integer tricheck (Draw_Interpretor& di, int n, const char ** a)
   TopoDS_Shape shape = DBRep::Get(a[1]);
   if (shape.IsNull()) return 1;
 
+  const Standard_Boolean isToFindSmallTriangles = (n >= 3) ? (strcmp(a[2], "-small") == 0) : Standard_False;
+
   TopTools_IndexedMapOfShape aMapF;
   TopExp::MapShapes (shape, TopAbs_FACE, aMapF);
-  Standard_CString name = ".";
+  const Standard_CString name = ".";
 
   // execute check
   MeshTest_CheckTopology aCheck(shape);
@@ -443,13 +448,74 @@ static Standard_Integer tricheck (Draw_Interpretor& di, int n, const char ** a)
     di << "\n";
   }
 
+  const Standard_Integer aNbSmallTriangles = isToFindSmallTriangles? aCheck.NbSmallTriangles() : 0;
+  if (aNbSmallTriangles > 0)
+  {
+    di << "triangles with null area (in pairs: face / triangle): \n";
+    for (i = 1; i <= aNbSmallTriangles; i++)
+    {
+      Standard_Integer aFaceId = 0, aTriID = 0;
+      aCheck.GetSmallTriangle(i, aFaceId, aTriID);
+
+      const TopoDS_Face& aFace = TopoDS::Face(aMapF.FindKey(aFaceId));
+      TopLoc_Location aLoc;
+      const gp_Trsf& aTrsf = aLoc.Transformation();
+      const Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(aFace, aLoc);
+      const Poly_Triangle &aTri = aT->Triangle(aTriID);
+      Standard_Integer aN1, aN2, aN3;
+      aTri.Get(aN1, aN2, aN3);
+      const TColgp_Array1OfPnt& aPoints = aT->Nodes();
+
+      TColgp_Array1OfPnt aPoles(1, 4);
+      aPoles(1) = aPoles(4) = aPoints(aN1).Transformed(aTrsf);
+      aPoles(2) = aPoints(aN2).Transformed(aTrsf);
+      aPoles(3) = aPoints(aN3).Transformed(aTrsf);
+
+      TColStd_Array1OfInteger aMults(1, 4);
+      aMults(1) = aMults(4) = 2;
+      aMults(2) = aMults(3) = 1;
+
+      TColStd_Array1OfReal aKnots(1, 4);
+      aKnots(1) = 1.0;
+      aKnots(2) = 2.0;
+      aKnots(3) = 3.0;
+      aKnots(4) = 4.0;
+      
+      Handle(Geom_BSplineCurve) aBS = new Geom_BSplineCurve(aPoles, aKnots, aMults, 1);
+
+      DrawTrSurf::Set(name, aBS);
+
+      if (aT->HasUVNodes())
+      {
+        TColgp_Array1OfPnt2d aPoles2d(1, 4);
+        aPoles2d(1) = aPoles2d(4) = aT->UVNodes()(aN1);
+        aPoles2d(2) = aT->UVNodes()(aN2);
+        aPoles2d(3) = aT->UVNodes()(aN3);
+
+        Handle(Geom2d_BSplineCurve) aBS2d = new Geom2d_BSplineCurve(aPoles2d, aKnots, aMults, 1);
+
+        DrawTrSurf::Set(name, aBS2d);
+      }
+
+      di << "{" << aFaceId << " " << aTriID << "} ";
+    }
+
+    di << "\n";
+  }
+
   // output errors summary to DRAW
-  if ( nbFree > 0 || nbErr > 0 || nbAsync > 0 || nbFreeNodes > 0)
+  if (nbFree > 0 ||
+      nbErr > 0 ||
+      nbAsync > 0 ||
+      nbFreeNodes > 0 ||
+      (aNbSmallTriangles > 0))
+  {
     di << "Free_links " << nbFree
-       << " Cross_face_errors " << nbErr
-       << " Async_edges " << nbAsync 
-       << " Free_nodes " << nbFreeNodes << "\n";
-
+      << " Cross_face_errors " << nbErr
+      << " Async_edges " << nbAsync
+      << " Free_nodes " << nbFreeNodes
+      << " Small triangles " << aNbSmallTriangles << "\n";
+  }
 
   Standard_Integer aFaceId = 1;
   TopExp_Explorer aFaceExp(shape, TopAbs_FACE);