1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +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;
}
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())
{
const gp_Trsf& T = aCurveLocation.Transformation();
Handle(Geom_Geometry) GPT = GP->Transformed(T);
Plane = *((Handle(Geom_Plane)*)&GPT);
Handle(Geom_Geometry) GC3d = C3d->Transformed(T);
C3d = *((Handle(Geom_Curve)*)&GC3d);
f = C3d->TransformedParameter(f, T);
l = C3d->TransformedParameter(l, T);
}
GeomAdaptor_Surface& GAS = HS->ChangeSurface();
GAS.Load(Plane);
GAS.Load(GP);
Handle(Geom_Curve) ProjOnPlane =
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,f,l,Standard_True,Standard_False),
Plane,
Plane->Position().Direction(),
GP,
GP->Position().Direction(),
Standard_True);
GeomAdaptor_Curve& GAC = HC->ChangeCurve();
@ -366,7 +368,7 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
(*((Handle(Geom2d_TrimmedCurve)*)&pc));
pc = TC->BasisCurve();
}
First = f; Last = l;
return pc;
}

View File

@ -132,7 +132,7 @@ void BRepCheck_Edge::Minimum()
if (!SameRange && SameParameter) {
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
// Handle(Geom_Curve) C3d;
// Handle(Geom_Curve) C3d;
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
@ -190,7 +190,8 @@ void BRepCheck_Edge::Minimum()
Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
(myCref->Curve3D()->Transformed
(/*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);
}
else { // curve on surface
@ -232,7 +233,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
Standard_Real Tol = BRep_Tool::Tolerance(TopoDS::Edge(myShape));
TopAbs_ShapeEnum styp = S.ShapeType();
// for (TopExp_Explorer exp(S,TopAbs_EDGE); exp.More(); exp.Next()) {
// for (TopExp_Explorer exp(S,TopAbs_EDGE); exp.More(); exp.Next()) {
TopExp_Explorer exp(S,TopAbs_EDGE) ;
for ( ; exp.More(); exp.Next()) {
if (exp.Current().IsSame(myShape)) {
@ -256,7 +257,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
Standard_Boolean SameParameter = TE->SameParameter();
Standard_Boolean SameRange = TE->SameRange();
// Modified by skv - Tue Apr 27 11:48:13 2004 Begin
// Modified by skv - Tue Apr 27 11:48:13 2004 Begin
if (!SameParameter || !SameRange) {
if (!SameParameter)
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
@ -265,7 +266,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
return;
}
// Modified by skv - Tue Apr 27 11:48:14 2004 End
// Modified by skv - Tue Apr 27 11:48:14 2004 End
Standard_Real First = myHCurve->FirstParameter();
Standard_Real Last = myHCurve->LastParameter();
@ -274,6 +275,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
const TopLoc_Location& TFloc = TF->Location();
const Handle(Geom_Surface)& Su = TF->Surface();
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;
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
@ -284,29 +287,31 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
Standard_Real 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
// 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(f-First) > Precision::PConfusion() ||
Abs(l-Last) > Precision::PConfusion()) {
// Modified by skv - Tue Apr 27 11:50:35 2004 Begin
if (Abs(ff-First) > Precision::PConfusion() ||
Abs(ll-Last) > Precision::PConfusion()) {
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
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) {
Handle(Geom_Surface) Sb = cr->Surface();
Sb = Handle(Geom_Surface)::DownCast
// (Su->Transformed(L.Transformation()));
// (Su->Transformed(L.Transformation()));
(Su->Transformed(/*L*/(Floc * TFloc).Transformation()));
Handle(Geom2d_Curve) PC = cr->PCurve();
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(Sb);
Handle(Geom2dAdaptor_HCurve) GHPC = new Geom2dAdaptor_HCurve(PC,f,l);
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
Standard_Boolean ok =
Validate(myHCurve->Curve(),ACS,Tol,SameParameter);
Validate(myHCurve->Curve() ,ACS,Tol,SameParameter);
if (!ok) {
if (cr->IsCurveOnClosedSurface()) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
@ -314,12 +319,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
else {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
}
// Modified by skv - Tue Apr 27 11:53:00 2004 Begin
// Modified by skv - Tue Apr 27 11:53:00 2004 Begin
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// if (SameParameter) {
// BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// }
// Modified by skv - Tue Apr 27 11:53:01 2004 End
// if (SameParameter) {
// BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// }
// Modified by skv - Tue Apr 27 11:53:01 2004 End
}
if (cr->IsCurveOnClosedSurface()) {
GHPC->ChangeCurve2d().Load(cr->PCurve2(),f,l); // same bounds
@ -328,11 +333,11 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter);
if (!ok) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
// Modified by skv - Tue Apr 27 11:53:20 2004 Begin
// Modified by skv - Tue Apr 27 11:53:20 2004 Begin
if (SameParameter) {
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
// Modified by skv - Tue Apr 27 11:53:23 2004 End
// Modified by skv - Tue Apr 27 11:53:23 2004 End
}
}
}
@ -433,12 +438,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
void BRepCheck_Edge::Blind()
{
// Modified by skv - Tue Apr 27 11:36:01 2004 Begin
// The body of this function is removed because of its useless.
// Modified by skv - Tue Apr 27 11:36:01 2004 Begin
// The body of this function is removed because of its useless.
if (!myBlind) {
myBlind = Standard_True;
}
// Modified by skv - Tue Apr 27 11:36:02 2004 End
// Modified by skv - Tue Apr 27 11:36:02 2004 End
}

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