--- /dev/null
+// 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;
+}
--- /dev/null
+// 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
#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)
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;
}
}
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 :
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,
//! 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(
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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
BRepMesh_EdgeParameterProvider.hxx
BRepMesh_EdgeTessellationExtractor.cxx
BRepMesh_EdgeTessellationExtractor.hxx
+BRepMesh_ExtrusionRangeSplitter.cxx
+BRepMesh_ExtrusionRangeSplitter.hxx
BRepMesh_FaceChecker.cxx
BRepMesh_FaceChecker.hxx
BRepMesh_FaceDiscret.cxx
BRepMesh_TorusRangeSplitter.cxx
BRepMesh_TorusRangeSplitter.hxx
BRepMesh_Triangle.hxx
+BRepMesh_UndefinedRangeSplitter.cxx
+BRepMesh_UndefinedRangeSplitter.hxx
BRepMesh_UVParamRangeSplitter.hxx
BRepMesh_Vertex.hxx
BRepMesh_VertexInspector.hxx