]> OCCT Git - occt.git/commitdiff
32241 patch was taken and updated regarding the 7.5.0 version of OCCT CR33608_750
authorakaftasev <akaftasev@opencascade.com>
Mon, 19 Feb 2024 15:29:12 +0000 (15:29 +0000)
committerakaftasev <akaftasev@opencascade.com>
Tue, 20 Feb 2024 13:38:23 +0000 (13:38 +0000)
src/BRepMesh/BRepMesh_ExtrusionRangeSplitter.cxx [new file with mode: 0644]
src/BRepMesh/BRepMesh_ExtrusionRangeSplitter.hxx [new file with mode: 0644]
src/BRepMesh/BRepMesh_MeshAlgoFactory.cxx
src/BRepMesh/BRepMesh_NURBSRangeSplitter.cxx
src/BRepMesh/BRepMesh_NURBSRangeSplitter.hxx
src/BRepMesh/BRepMesh_UndefinedRangeSplitter.cxx [new file with mode: 0644]
src/BRepMesh/BRepMesh_UndefinedRangeSplitter.hxx [new file with mode: 0644]
src/BRepMesh/FILES

diff --git a/src/BRepMesh/BRepMesh_ExtrusionRangeSplitter.cxx b/src/BRepMesh/BRepMesh_ExtrusionRangeSplitter.cxx
new file mode 100644 (file)
index 0000000..0a52fa3
--- /dev/null
@@ -0,0 +1,46 @@
+// Created on: 2022-09-07
+// Copyright (c) 2022 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_ExtrusionRangeSplitter.hxx>
+#include <Adaptor3d_HCurve.hxx>
+
+//=======================================================================
+// Function: getUndefinedIntervalNb
+// Purpose : 
+//=======================================================================
+Standard_Integer BRepMesh_ExtrusionRangeSplitter::getUndefinedIntervalNb(
+  const Handle(Adaptor3d_HSurface)& theSurface,
+  const Standard_Boolean           /*isU*/,
+  const GeomAbs_Shape              theContinuity) const
+{
+  // Here we need just a regular grid along dimension with no 
+  // geometrical data regarding intervals like extrusion surface.
+  const Handle(Adaptor3d_HCurve) aCurve = theSurface->BasisCurve();
+  Standard_Integer aIntervalsNb = aCurve->NbIntervals(theContinuity);
+  if (aIntervalsNb == 1)
+  {
+    const GeomAbs_CurveType aCurveType = aCurve->GetType();
+    const Standard_Boolean isBSplineCurve =
+      aCurveType == GeomAbs_BezierCurve ||
+      aCurveType == GeomAbs_BSplineCurve;
+
+    if (isBSplineCurve)
+    {
+      aIntervalsNb = aCurve->NbPoles() - 1;
+    }
+  }
+
+  return aIntervalsNb;
+}
diff --git a/src/BRepMesh/BRepMesh_ExtrusionRangeSplitter.hxx b/src/BRepMesh/BRepMesh_ExtrusionRangeSplitter.hxx
new file mode 100644 (file)
index 0000000..f12bcdb
--- /dev/null
@@ -0,0 +1,45 @@
+// Created on: 2022-09-07
+// Copyright (c) 2022 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_ExtrusionRangeSplitter_HeaderFile
+#define _BRepMesh_ExtrusionRangeSplitter_HeaderFile
+
+#include <BRepMesh_NURBSRangeSplitter.hxx>
+
+//! Auxiliary class analysing extrusion surface in order to generate internal nodes.
+class BRepMesh_ExtrusionRangeSplitter : public BRepMesh_NURBSRangeSplitter
+{
+public:
+
+  //! Constructor.
+  BRepMesh_ExtrusionRangeSplitter()
+  {
+  }
+
+  //! Destructor.
+  virtual ~BRepMesh_ExtrusionRangeSplitter()
+  {
+  }
+
+protected:
+
+  //! Returns number of intervals computed using available geometrical parameters.
+  Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
+    const Handle(Adaptor3d_HSurface)& theSurface,
+    const Standard_Boolean           isU,
+    const GeomAbs_Shape              theContinuity) const Standard_OVERRIDE;
+};
+
+#endif
index e6650d27e9c9bc629092f625a91b666f17c6d465..8058b247bb7e350baebe6417d3874f8315856b08 100644 (file)
@@ -24,6 +24,8 @@
 #include <BRepMesh_DelaunayNodeInsertionMeshAlgo.hxx>
 #include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx>
 #include <BRepMesh_BoundaryParamsRangeSplitter.hxx>
+#include <BRepMesh_ExtrusionRangeSplitter.hxx>
+#include <BRepMesh_UndefinedRangeSplitter.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory)
 
@@ -101,7 +103,18 @@ Handle(IMeshTools_MeshAlgo) BRepMesh_MeshAlgoFactory::GetAlgo(
     return new DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type;
     break;
 
-  default:
+  case GeomAbs_SurfaceOfExtrusion:
+    return new DeflectionControlMeshAlgo<BRepMesh_ExtrusionRangeSplitter>::Type;
+    break;
+
+  case GeomAbs_BezierSurface:
+  case GeomAbs_BSplineSurface:
     return new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type;
+    break;
+
+  case GeomAbs_OffsetSurface:
+  case GeomAbs_OtherSurface:
+  default:
+    return new DeflectionControlMeshAlgo<BRepMesh_UndefinedRangeSplitter>::Type;
   }
 }
index e64f1980ba03bb2c3709b09f6c38cc9b2c1468b4..1ad3273c2d6647cf69b17475d0d35f68a81d3da5 100644 (file)
@@ -392,6 +392,61 @@ Handle(IMeshData::ListOfPnt2d) BRepMesh_NURBSRangeSplitter::GenerateSurfaceNodes
   return aNodes;
 }
 
+//=======================================================================
+// Function: getUndefinedIntervalNb
+// Purpose : 
+//=======================================================================
+Standard_Integer BRepMesh_NURBSRangeSplitter::getUndefinedIntervalNb(
+  const Handle(Adaptor3d_HSurface)& theSurface,
+  const Standard_Boolean           isU,
+  const GeomAbs_Shape              /*theContinuity*/) const
+{
+  return (isU ? theSurface->NbUPoles() : theSurface->NbVPoles()) - 1;
+}
+
+//=======================================================================
+// Function: getUndefinedInterval
+// Purpose : 
+//=======================================================================
+void BRepMesh_NURBSRangeSplitter::getUndefinedInterval(
+  const Handle(Adaptor3d_HSurface)&               theSurface,
+  const Standard_Boolean                         isU,
+  const GeomAbs_Shape                            theContinuity,
+  const std::pair<Standard_Real, Standard_Real>& theRange,
+  TColStd_Array1OfReal&                          theIntervals) const
+{
+  Standard_Integer aIntervalsNb = isU ? 
+    theSurface->NbUIntervals(theContinuity) :
+    theSurface->NbVIntervals(theContinuity);
+
+  if (aIntervalsNb == 1)
+  {
+    aIntervalsNb = getUndefinedIntervalNb(theSurface, isU, theContinuity);
+    if (aIntervalsNb > 1)
+    {
+      theIntervals = TColStd_Array1OfReal(1, aIntervalsNb - 1);
+      const Standard_Real aDiff = (theRange.second - theRange.first) / aIntervalsNb;
+      for (Standard_Integer i = theIntervals.Lower(); i <= theIntervals.Upper(); ++i)
+      {
+        theIntervals.SetValue(i, theRange.first + i * aDiff);
+      }
+    }
+  }
+
+  if (theIntervals.IsEmpty())
+  {
+    theIntervals = TColStd_Array1OfReal(1, aIntervalsNb + 1);
+    if (isU)
+    {
+      theSurface->UIntervals(theIntervals, theContinuity);
+    }
+    else
+    {
+      theSurface->VIntervals(theIntervals, theContinuity);
+    }
+  }
+}
+
 //=======================================================================
 // Function: initParameters
 // Purpose : 
@@ -399,22 +454,17 @@ Handle(IMeshData::ListOfPnt2d) BRepMesh_NURBSRangeSplitter::GenerateSurfaceNodes
 Standard_Boolean BRepMesh_NURBSRangeSplitter::initParameters() const
 {
   const Handle(BRepAdaptor_HSurface)& aSurface = GetSurface();
-
   const GeomAbs_Shape aContinuity = GeomAbs_CN;
   const std::pair<Standard_Integer, Standard_Integer> aIntervalsNb(
     aSurface->NbUIntervals(aContinuity),
     aSurface->NbVIntervals(aContinuity)
   );
 
-  TColStd_Array1OfReal aIntervals[2] = {
-    TColStd_Array1OfReal(1, aIntervalsNb.first  + 1),
-    TColStd_Array1OfReal(1, aIntervalsNb.second + 1)
-  };
-
-  aSurface->UIntervals(aIntervals[0], aContinuity);
-  aSurface->VIntervals(aIntervals[1], aContinuity);
+  TColStd_Array1OfReal aIntervals[2];
+  getUndefinedInterval(aSurface, Standard_True,  aContinuity, GetRangeU(), aIntervals[0]);
+  getUndefinedInterval(aSurface, Standard_False, aContinuity, GetRangeV(), aIntervals[1]);
 
-  const Standard_Boolean isSplitIntervals = toSplitIntervals (
+  const Standard_Boolean isSplitIntervals = toSplitIntervals(
     aSurface->ChangeSurface().Surface().Surface(), aIntervals);
 
   if (!initParamsFromIntervals(aIntervals[0], GetRangeU(), isSplitIntervals,
index 9dfc40973b5f97758456b9d84eac6c9fd9e3b947..23e9ac3d3b00d107c6dcdfe6652edaa48481ecc8 100644 (file)
@@ -49,7 +49,21 @@ protected:
   //! Initializes U and V parameters lists using CN continuity intervals.
   Standard_EXPORT virtual Standard_Boolean initParameters() const;
 
+  //! Returns number of intervals computed using available geometrical parameters.
+  Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
+    const Handle(Adaptor3d_HSurface)& theSurface,
+    const Standard_Boolean           isU,
+    const GeomAbs_Shape              theContinuity) const;
+
 private:
+  //! Tries to compute intervals even for cases with no intervals 
+  //! at all using available geometrical parameters.
+  void getUndefinedInterval(
+    const Handle(Adaptor3d_HSurface)&               theSurface,
+    const Standard_Boolean                         isU,
+    const GeomAbs_Shape                            theContinuity,
+    const std::pair<Standard_Real, Standard_Real>& theRange,
+    TColStd_Array1OfReal&                          theIntervals) const;
 
   //! Computes parameters of filter and applies it to the source parameters.
   Handle(IMeshData::SequenceOfReal) computeGrainAndFilterParameters(
diff --git a/src/BRepMesh/BRepMesh_UndefinedRangeSplitter.cxx b/src/BRepMesh/BRepMesh_UndefinedRangeSplitter.cxx
new file mode 100644 (file)
index 0000000..fd0b6e9
--- /dev/null
@@ -0,0 +1,28 @@
+// Created on: 2022-09-07
+// Copyright (c) 2022 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_UndefinedRangeSplitter.hxx>
+
+//=======================================================================
+// Function: getUndefinedIntervalNb
+// Purpose : 
+//=======================================================================
+Standard_Integer BRepMesh_UndefinedRangeSplitter::getUndefinedIntervalNb(
+  const Handle(Adaptor3d_HSurface)& /*theSurface*/,
+  const Standard_Boolean           /*isU*/,
+  const GeomAbs_Shape              /*theContinuity*/) const
+{
+  return 1;
+}
diff --git a/src/BRepMesh/BRepMesh_UndefinedRangeSplitter.hxx b/src/BRepMesh/BRepMesh_UndefinedRangeSplitter.hxx
new file mode 100644 (file)
index 0000000..1c88823
--- /dev/null
@@ -0,0 +1,46 @@
+// Created on: 2022-09-07
+// Copyright (c) 2022 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_UndefinedRangeSplitter_HeaderFile
+#define _BRepMesh_UndefinedRangeSplitter_HeaderFile
+
+#include <BRepMesh_NURBSRangeSplitter.hxx>
+
+//! Auxiliary class provides safe value for surfaces that looks like NURBS 
+//! but has no poles or other characteristics.
+class BRepMesh_UndefinedRangeSplitter : public BRepMesh_NURBSRangeSplitter
+{
+public:
+
+  //! Constructor.
+  BRepMesh_UndefinedRangeSplitter()
+  {
+  }
+
+  //! Destructor.
+  virtual ~BRepMesh_UndefinedRangeSplitter()
+  {
+  }
+
+protected:
+
+  //! Returns number of intervals computed using available geometrical parameters.
+  Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
+    const Handle(Adaptor3d_HSurface)& theSurface,
+    const Standard_Boolean           isU,
+    const GeomAbs_Shape              theContinuity) const Standard_OVERRIDE;
+};
+
+#endif
index 90df7c410b002b10eb30068ec21942ac43aedef6..c81997d6a550a7ede0df46cffdd7e7fb19e775f9 100755 (executable)
@@ -40,6 +40,8 @@ BRepMesh_EdgeDiscret.hxx
 BRepMesh_EdgeParameterProvider.hxx
 BRepMesh_EdgeTessellationExtractor.cxx
 BRepMesh_EdgeTessellationExtractor.hxx
+BRepMesh_ExtrusionRangeSplitter.cxx
+BRepMesh_ExtrusionRangeSplitter.hxx
 BRepMesh_FaceChecker.cxx
 BRepMesh_FaceChecker.hxx
 BRepMesh_FaceDiscret.cxx
@@ -80,6 +82,8 @@ BRepMesh_SphereRangeSplitter.hxx
 BRepMesh_TorusRangeSplitter.cxx
 BRepMesh_TorusRangeSplitter.hxx
 BRepMesh_Triangle.hxx
+BRepMesh_UndefinedRangeSplitter.cxx
+BRepMesh_UndefinedRangeSplitter.hxx
 BRepMesh_UVParamRangeSplitter.hxx
 BRepMesh_Vertex.hxx
 BRepMesh_VertexInspector.hxx