1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0029591: Improvements in the class BRepOffset_Tool

- Add the flag ExtensionMode in the method BRepOffset_Tool::EnLargeFace, defining the mode of extension of the surface of the face. Old behavior is to be remained the default one.

- Fix wrong building of extended face on a closed surface. Now, if the face is closed in U direction (like cylinder) but the seam edge is shifted from 0 position, the resulting extended face has properly connected seam edge.

- Add new public static method BRepTools::DetectClosedness(), which checks whether a face is closed in U and V directions.
This commit is contained in:
jgv
2018-03-23 16:08:11 +03:00
committed by bugmaster
parent c37f570215
commit 11af6cddf5
4 changed files with 107 additions and 38 deletions

View File

@@ -25,6 +25,7 @@
#include <BRepTools.hxx>
#include <BRepTools_MapOfVertexPnt2d.hxx>
#include <BRepTools_ShapeSet.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <ElCLib.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
@@ -64,6 +65,27 @@
#include <TopTools_SequenceOfShape.hxx>
#include <GeomLib_CheckCurveOnSurface.hxx>
#include <errno.h>
//=======================================================================
//function : IsPCurveUiso
//purpose :
//=======================================================================
static Standard_Boolean IsPCurveUiso(const Handle(Geom2d_Curve)& thePCurve,
Standard_Real theFirstPar,
Standard_Real theLastPar)
{
gp_Pnt2d FirstP2d = thePCurve->Value(theFirstPar);
gp_Pnt2d LastP2d = thePCurve->Value(theLastPar);
Standard_Real DeltaU = Abs(FirstP2d.X() - LastP2d.X());
Standard_Real DeltaV = Abs(FirstP2d.Y() - LastP2d.Y());
return (DeltaU < DeltaV);
}
//=======================================================================
//function : UVBounds
//purpose :
@@ -994,6 +1016,43 @@ Standard_Boolean BRepTools::IsReallyClosed(const TopoDS_Edge& E,
return nbocc == 2;
}
//=======================================================================
//function : DetectClosedness
//purpose :
//=======================================================================
void BRepTools::DetectClosedness(const TopoDS_Face& theFace,
Standard_Boolean& theUclosed,
Standard_Boolean& theVclosed)
{
theUclosed = theVclosed = Standard_False;
BRepAdaptor_Surface BAsurf(theFace, Standard_False);
Standard_Boolean IsSurfUclosed = BAsurf.IsUClosed();
Standard_Boolean IsSurfVclosed = BAsurf.IsVClosed();
if (!IsSurfUclosed && !IsSurfVclosed)
return;
TopExp_Explorer Explo(theFace, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
if (BRepTools::IsReallyClosed(anEdge, theFace))
{
Standard_Real fpar, lpar;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, theFace, fpar, lpar);
Standard_Boolean IsUiso = IsPCurveUiso(aPCurve, fpar, lpar);
if (IsSurfUclosed && IsUiso)
theUclosed = Standard_True;
if (IsSurfVclosed && !IsUiso)
theVclosed = Standard_True;
if (theUclosed && theVclosed)
break;
}
}
}
//=======================================================================
//function : EvalAndUpdateTol
//purpose :

View File

@@ -186,6 +186,11 @@ public:
//! the face <F> before calling BRep_Tool::IsClosed.
Standard_EXPORT static Standard_Boolean IsReallyClosed (const TopoDS_Edge& E, const TopoDS_Face& F);
//! Detect closedness of face in U and V directions
Standard_EXPORT static void DetectClosedness (const TopoDS_Face& theFace,
Standard_Boolean& theUclosed,
Standard_Boolean& theVclosed);
//! Dumps the topological structure and the geometry
//! of <Sh> on the stream <S>.
Standard_EXPORT static void Dump (const TopoDS_Shape& Sh, Standard_OStream& S);