From: akaftasev Date: Mon, 19 Feb 2024 15:29:12 +0000 (+0000) Subject: 32241 patch was taken and updated regarding the 7.5.0 version of OCCT X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=3471a0b8e12ac83812d940d919b12622d9d57d30;p=occt.git 32241 patch was taken and updated regarding the 7.5.0 version of OCCT --- diff --git a/src/BRepMesh/BRepMesh_ExtrusionRangeSplitter.cxx b/src/BRepMesh/BRepMesh_ExtrusionRangeSplitter.cxx new file mode 100644 index 0000000000..0a52fa31f4 --- /dev/null +++ b/src/BRepMesh/BRepMesh_ExtrusionRangeSplitter.cxx @@ -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 +#include + +//======================================================================= +// 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 index 0000000000..f12bcdbd6f --- /dev/null +++ b/src/BRepMesh/BRepMesh_ExtrusionRangeSplitter.hxx @@ -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 + +//! 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 diff --git a/src/BRepMesh/BRepMesh_MeshAlgoFactory.cxx b/src/BRepMesh/BRepMesh_MeshAlgoFactory.cxx index e6650d27e9..8058b247bb 100644 --- a/src/BRepMesh/BRepMesh_MeshAlgoFactory.cxx +++ b/src/BRepMesh/BRepMesh_MeshAlgoFactory.cxx @@ -24,6 +24,8 @@ #include #include #include +#include +#include IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory) @@ -101,7 +103,18 @@ Handle(IMeshTools_MeshAlgo) BRepMesh_MeshAlgoFactory::GetAlgo( return new DeflectionControlMeshAlgo::Type; break; - default: + case GeomAbs_SurfaceOfExtrusion: + return new DeflectionControlMeshAlgo::Type; + break; + + case GeomAbs_BezierSurface: + case GeomAbs_BSplineSurface: return new DeflectionControlMeshAlgo::Type; + break; + + case GeomAbs_OffsetSurface: + case GeomAbs_OtherSurface: + default: + return new DeflectionControlMeshAlgo::Type; } } diff --git a/src/BRepMesh/BRepMesh_NURBSRangeSplitter.cxx b/src/BRepMesh/BRepMesh_NURBSRangeSplitter.cxx index e64f1980ba..1ad3273c2d 100644 --- a/src/BRepMesh/BRepMesh_NURBSRangeSplitter.cxx +++ b/src/BRepMesh/BRepMesh_NURBSRangeSplitter.cxx @@ -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& 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 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, diff --git a/src/BRepMesh/BRepMesh_NURBSRangeSplitter.hxx b/src/BRepMesh/BRepMesh_NURBSRangeSplitter.hxx index 9dfc40973b..23e9ac3d3b 100644 --- a/src/BRepMesh/BRepMesh_NURBSRangeSplitter.hxx +++ b/src/BRepMesh/BRepMesh_NURBSRangeSplitter.hxx @@ -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& 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 index 0000000000..fd0b6e986c --- /dev/null +++ b/src/BRepMesh/BRepMesh_UndefinedRangeSplitter.cxx @@ -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 + +//======================================================================= +// 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 index 0000000000..1c888234df --- /dev/null +++ b/src/BRepMesh/BRepMesh_UndefinedRangeSplitter.hxx @@ -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 + +//! 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 diff --git a/src/BRepMesh/FILES b/src/BRepMesh/FILES index 90df7c410b..c81997d6a5 100755 --- a/src/BRepMesh/FILES +++ b/src/BRepMesh/FILES @@ -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