1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

32241 patch was taken and updated regarding the 7.5.0 version of OCCT

This commit is contained in:
akaftasev
2024-02-19 15:29:12 +00:00
parent b20ae1d3f5
commit 3471a0b8e1
8 changed files with 256 additions and 10 deletions

View File

@@ -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;
}

View File

@@ -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

View 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;
}
}

View 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)
};
TColStd_Array1OfReal aIntervals[2];
getUndefinedInterval(aSurface, Standard_True, aContinuity, GetRangeU(), aIntervals[0]);
getUndefinedInterval(aSurface, Standard_False, aContinuity, GetRangeV(), aIntervals[1]);
aSurface->UIntervals(aIntervals[0], aContinuity);
aSurface->VIntervals(aIntervals[1], aContinuity);
const Standard_Boolean isSplitIntervals = toSplitIntervals (
const Standard_Boolean isSplitIntervals = toSplitIntervals(
aSurface->ChangeSurface().Surface().Surface(), aIntervals);
if (!initParamsFromIntervals(aIntervals[0], GetRangeU(), isSplitIntervals,

View 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(

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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