1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-08 18:40:55 +03:00

0026330: BRepOffsetAPI_ThruSections creates invalid shape

Test case for issue CR26330
This commit is contained in:
ifv 2015-06-25 13:08:47 +03:00 committed by bugmaster
parent 539d3a1b7f
commit b77233473a
3 changed files with 276 additions and 248 deletions

View File

@ -337,22 +337,24 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
return nullPCurve; return nullPCurve;
} }
aCurveLocation = L.Predivided(aCurveLocation); aCurveLocation = aCurveLocation.Predivided(L);
First = f; Last = l; //Range of edge must not be modified
Handle(Geom_Plane) Plane = GP;
if (!aCurveLocation.IsIdentity()) if (!aCurveLocation.IsIdentity())
{ {
const gp_Trsf& T = aCurveLocation.Transformation(); const gp_Trsf& T = aCurveLocation.Transformation();
Handle(Geom_Geometry) GPT = GP->Transformed(T); Handle(Geom_Geometry) GC3d = C3d->Transformed(T);
Plane = *((Handle(Geom_Plane)*)&GPT); C3d = *((Handle(Geom_Curve)*)&GC3d);
f = C3d->TransformedParameter(f, T);
l = C3d->TransformedParameter(l, T);
} }
GeomAdaptor_Surface& GAS = HS->ChangeSurface(); GeomAdaptor_Surface& GAS = HS->ChangeSurface();
GAS.Load(Plane); GAS.Load(GP);
Handle(Geom_Curve) ProjOnPlane = Handle(Geom_Curve) ProjOnPlane =
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,f,l,Standard_True,Standard_False), GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,f,l,Standard_True,Standard_False),
Plane, GP,
Plane->Position().Direction(), GP->Position().Direction(),
Standard_True); Standard_True);
GeomAdaptor_Curve& GAC = HC->ChangeCurve(); GeomAdaptor_Curve& GAC = HC->ChangeCurve();
@ -366,7 +368,7 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
(*((Handle(Geom2d_TrimmedCurve)*)&pc)); (*((Handle(Geom2d_TrimmedCurve)*)&pc));
pc = TC->BasisCurve(); pc = TC->BasisCurve();
} }
First = f; Last = l;
return pc; return pc;
} }

View File

@ -190,7 +190,8 @@ void BRepCheck_Edge::Minimum()
Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
(myCref->Curve3D()->Transformed (myCref->Curve3D()->Transformed
(/*myCref->Location()*/L.Transformation())); (/*myCref->Location()*/L.Transformation()));
GeomAdaptor_Curve GAC3d(C3d,First,Last); GeomAdaptor_Curve GAC3d(C3d, C3d->TransformedParameter(First, L.Transformation()),
C3d->TransformedParameter(Last, L.Transformation()));
myHCurve = new GeomAdaptor_HCurve(GAC3d); myHCurve = new GeomAdaptor_HCurve(GAC3d);
} }
else { // curve on surface else { // curve on surface
@ -274,6 +275,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
const TopLoc_Location& TFloc = TF->Location(); const TopLoc_Location& TFloc = TF->Location();
const Handle(Geom_Surface)& Su = TF->Surface(); const Handle(Geom_Surface)& Su = TF->Surface();
TopLoc_Location L = (Floc * TFloc).Predivided(myShape.Location()); TopLoc_Location L = (Floc * TFloc).Predivided(myShape.Location());
TopLoc_Location LE = myShape.Location() * myCref->Location();
const gp_Trsf& Etrsf = LE.Transformation();
Standard_Boolean pcurvefound = Standard_False; Standard_Boolean pcurvefound = Standard_False;
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves()); BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
@ -284,16 +287,18 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
Standard_Real f,l; Standard_Real f,l;
GC->Range(f,l); GC->Range(f,l);
Standard_Real ff = f, ll = l;
if(myCref->IsCurve3D())
{
ff = myCref->Curve3D()->TransformedParameter(f, Etrsf);
ll = myCref->Curve3D()->TransformedParameter(l, Etrsf);
}
// gka OCC // gka OCC
// Modified by skv - Tue Apr 27 11:50:35 2004 Begin // Modified by skv - Tue Apr 27 11:50:35 2004 Begin
// if (SameRange && (fabs(f-First) > Precision::PConfusion() || fabs(l-Last)> Precision::PConfusion())) { //f != First || l != Last)) { gka OCC if (Abs(ff-First) > Precision::PConfusion() ||
if (Abs(f-First) > Precision::PConfusion() || Abs(ll-Last) > Precision::PConfusion()) {
Abs(l-Last) > Precision::PConfusion()) {
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag); BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag); BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// if (SameParameter) {
// BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// }
} }
// Modified by skv - Tue Apr 27 11:50:37 2004 End // Modified by skv - Tue Apr 27 11:50:37 2004 End
if (myGctrl) { if (myGctrl) {

View File

@ -0,0 +1,21 @@
puts "=========="
puts "OCC26330"
puts "=========="
puts ""
############################################################
# BRepOffsetAPI_ThruSections creates invalid shape
############################################################
restore [locate_data_file bug26330_s1.brep] s1
restore [locate_data_file bug26330_s2.brep] s2
# both wires seem okay
checkshape s1
checkshape s2
thrusections result 1 1 s1 s2
# check subshapes
checkshape result
set 3dviewer 1