mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0030560: Modeling Algorithms - Improvement of the method BRepTools::DetectClosedness
1. Rewrite the method BRepTools::DetectClosedness. 2. Correct the method BRepOffset_Tool::EnLargeFace to process properly non-periodic but closed faces.
This commit is contained in:
parent
31fe1f8ec4
commit
85c103d277
@ -3103,6 +3103,7 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
|
|||||||
TopLoc_Location L;
|
TopLoc_Location L;
|
||||||
Handle (Geom_Surface) S = BRep_Tool::Surface(F,L);
|
Handle (Geom_Surface) S = BRep_Tool::Surface(F,L);
|
||||||
Standard_Real UU1,VV1,UU2,VV2;
|
Standard_Real UU1,VV1,UU2,VV2;
|
||||||
|
Standard_Boolean uperiodic = Standard_False, vperiodic = Standard_False;
|
||||||
Standard_Boolean isVV1degen = Standard_False, isVV2degen = Standard_False;
|
Standard_Boolean isVV1degen = Standard_False, isVV2degen = Standard_False;
|
||||||
Standard_Real US1,VS1,US2,VS2;
|
Standard_Real US1,VS1,US2,VS2;
|
||||||
Standard_Real UF1,VF1,UF2,VF2;
|
Standard_Real UF1,VF1,UF2,VF2;
|
||||||
@ -3146,6 +3147,7 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (S->IsUPeriodic()) {
|
if (S->IsUPeriodic()) {
|
||||||
|
uperiodic = Standard_True;
|
||||||
Standard_Real Period = S->UPeriod();
|
Standard_Real Period = S->UPeriod();
|
||||||
Standard_Real Delta = Period - (UF2 - UF1);
|
Standard_Real Delta = Period - (UF2 - UF1);
|
||||||
Standard_Real alpha = 0.1;
|
Standard_Real alpha = 0.1;
|
||||||
@ -3155,6 +3157,7 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (S->IsVPeriodic()) {
|
if (S->IsVPeriodic()) {
|
||||||
|
vperiodic = Standard_True;
|
||||||
Standard_Real Period = S->VPeriod();
|
Standard_Real Period = S->VPeriod();
|
||||||
Standard_Real Delta = Period - (VF2 - VF1);
|
Standard_Real Delta = Period - (VF2 - VF1);
|
||||||
Standard_Real alpha = 0.1;
|
Standard_Real alpha = 0.1;
|
||||||
@ -3199,6 +3202,12 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
|
|||||||
//Detect closedness in U and V directions
|
//Detect closedness in U and V directions
|
||||||
Standard_Boolean uclosed = Standard_False, vclosed = Standard_False;
|
Standard_Boolean uclosed = Standard_False, vclosed = Standard_False;
|
||||||
BRepTools::DetectClosedness(F, uclosed, vclosed);
|
BRepTools::DetectClosedness(F, uclosed, vclosed);
|
||||||
|
if (uclosed && !uperiodic &&
|
||||||
|
(theLenBeforeUfirst != 0. || theLenAfterUlast != 0.))
|
||||||
|
uclosed = Standard_False;
|
||||||
|
if (vclosed && !vperiodic &&
|
||||||
|
(theLenBeforeVfirst != 0. && theLenAfterVlast != 0.))
|
||||||
|
vclosed = Standard_False;
|
||||||
|
|
||||||
MakeFace(S,UU1,UU2,VV1,VV2,uclosed,vclosed,isVV1degen,isVV2degen,BF);
|
MakeFace(S,UU1,UU2,VV1,VV2,uclosed,vclosed,isVV1degen,isVV2degen,BF);
|
||||||
BF.Location(L);
|
BF.Location(L);
|
||||||
|
@ -67,25 +67,6 @@
|
|||||||
#include <errno.h>
|
#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
|
//function : UVBounds
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -977,28 +958,24 @@ void BRepTools::DetectClosedness(const TopoDS_Face& theFace,
|
|||||||
{
|
{
|
||||||
theUclosed = theVclosed = Standard_False;
|
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);
|
TopExp_Explorer Explo(theFace, TopAbs_EDGE);
|
||||||
for (; Explo.More(); Explo.Next())
|
for (; Explo.More(); Explo.Next())
|
||||||
{
|
{
|
||||||
const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
|
const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
|
||||||
if (BRepTools::IsReallyClosed(anEdge, theFace))
|
if (BRep_Tool::IsClosed(anEdge, theFace) &&
|
||||||
|
BRepTools::IsReallyClosed(anEdge, theFace))
|
||||||
{
|
{
|
||||||
Standard_Real fpar, lpar;
|
Standard_Real fpar, lpar;
|
||||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, theFace, fpar, lpar);
|
Handle(Geom2d_Curve) PCurve1 = BRep_Tool::CurveOnSurface(anEdge, theFace, fpar, lpar);
|
||||||
Standard_Boolean IsUiso = IsPCurveUiso(aPCurve, fpar, lpar);
|
Handle(Geom2d_Curve) PCurve2 = BRep_Tool::CurveOnSurface(TopoDS::Edge(anEdge.Reversed()),
|
||||||
if (IsSurfUclosed && IsUiso)
|
theFace, fpar, lpar);
|
||||||
|
gp_Pnt2d Point1 = PCurve1->Value(fpar);
|
||||||
|
gp_Pnt2d Point2 = PCurve2->Value(fpar);
|
||||||
|
Standard_Boolean IsUiso = (Abs(Point1.X() - Point2.X()) > Abs(Point1.Y() - Point2.Y()));
|
||||||
|
if (IsUiso)
|
||||||
theUclosed = Standard_True;
|
theUclosed = Standard_True;
|
||||||
if (IsSurfVclosed && !IsUiso)
|
else
|
||||||
theVclosed = Standard_True;
|
theVclosed = Standard_True;
|
||||||
|
|
||||||
if (theUclosed && theVclosed)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
tests/bugs/modalg_7/bug30560_1
Normal file
12
tests/bugs/modalg_7/bug30560_1
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
puts "==============================================================="
|
||||||
|
puts "OCC30560: Improvement of the method BRepTools::DetectClosedness"
|
||||||
|
puts "==============================================================="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
pload QAcommands
|
||||||
|
|
||||||
|
restore [locate_data_file bug30560_face.brep] a
|
||||||
|
|
||||||
|
OCC30391 result a 0. 0. 2. 2.
|
||||||
|
|
||||||
|
checknbshapes result -vertex 2 -edge 3
|
12
tests/bugs/modalg_7/bug30560_2
Normal file
12
tests/bugs/modalg_7/bug30560_2
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
puts "==============================================================="
|
||||||
|
puts "OCC30560: Improvement of the method BRepTools::DetectClosedness"
|
||||||
|
puts "==============================================================="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
pload QAcommands
|
||||||
|
|
||||||
|
restore [locate_data_file bug30560_face.brep] a
|
||||||
|
|
||||||
|
OCC30391 result a 2. 2. 2. 2.
|
||||||
|
|
||||||
|
checknbshapes result -vertex 4 -edge 4
|
Loading…
x
Reference in New Issue
Block a user