1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0033179: Modeling Algorithms - Crash in ShapeFix_Shape with the attached object, when healing for fixing SameParameterFlag

BSplCLib_2.cxx - method MergeBSplineKnots is modified in order to have always not empty result.
Geom2dConvert.cxx - in static function MultNumandDenom tolerance for comparing knots is decreased.

tests/bugs/modalg_8/bug33179 test case added
This commit is contained in:
ifv 2022-10-24 12:25:03 +03:00 committed by vglukhik
parent 1eb623f2ba
commit 8c7a2aa65f
3 changed files with 78 additions and 72 deletions

View File

@ -1234,5 +1234,20 @@ void BSplCLib::MergeBSplineKnots
} }
NumPoles = index - degree - 1; NumPoles = index - degree - 1;
} }
else
{
degree = Degree1 + Degree2;
num_knots = 2;
NewKnots =
new TColStd_HArray1OfReal(1, num_knots);
NewKnots->ChangeArray1()(1) = StartValue;
NewKnots->ChangeArray1()(num_knots) = EndValue;
NewMults =
new TColStd_HArray1OfInteger(1, num_knots);
NewMults->ChangeArray1()(1) = degree + 1;
NewMults->ChangeArray1()(num_knots) = degree + 1;
NumPoles = BSplCLib::NbPoles(degree, Standard_False, NewMults->Array1());
}
} }

View File

@ -515,7 +515,6 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
Handle(TColStd_HArray1OfReal) resKnots; Handle(TColStd_HArray1OfReal) resKnots;
Handle(TColStd_HArray1OfInteger) resMults; Handle(TColStd_HArray1OfInteger) resMults;
Standard_Real start_value,end_value; Standard_Real start_value,end_value;
Standard_Real tolerance=Precision::Confusion();
Standard_Integer resNbPoles,degree, Standard_Integer resNbPoles,degree,
ii,jj, ii,jj,
aStatus; aStatus;
@ -527,6 +526,7 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
BS->KnotSequence(BSFlatKnots); BS->KnotSequence(BSFlatKnots);
start_value = BSKnots(1); start_value = BSKnots(1);
end_value = BSKnots(BS->NbKnots()); end_value = BSKnots(BS->NbKnots());
Standard_Real tolerance = 10.*Epsilon(Abs(end_value));
a->Knots(aKnots); a->Knots(aKnots);
a->Poles(aPoles); a->Poles(aPoles);
@ -565,22 +565,6 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
degree, degree,
resDenPoles, resDenPoles,
aStatus); aStatus);
// BSplCLib::FunctionMultiply(law_evaluator,
// BS->Degree(),
// BSFlatKnots,
// BSPoles,
// resFlatKnots,
// degree,
// resNumPoles,
// aStatus);
// BSplCLib::FunctionMultiply(law_evaluator,
// BS->Degree(),
// BSFlatKnots,
// BSWeights,
// resFlatKnots,
// degree,
// resDenPoles,
// aStatus);
for (ii=1;ii<=resNbPoles;ii++) for (ii=1;ii<=resNbPoles;ii++)
for(jj=1;jj<=2;jj++) for(jj=1;jj<=2;jj++)
resPoles(ii).SetCoord(jj,resNumPoles(ii).Coord(jj)/resDenPoles(ii)); resPoles(ii).SetCoord(jj,resNumPoles(ii).Coord(jj)/resDenPoles(ii));
@ -1339,7 +1323,6 @@ void Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
Curve1Poles(ii).SetCoord(jj,Curve1Poles(ii).Coord(jj)*Curve1Weights(ii)); Curve1Poles(ii).SetCoord(jj,Curve1Poles(ii).Coord(jj)*Curve1Weights(ii));
//POP pour NT //POP pour NT
Geom2dConvert_reparameterise_evaluator ev (aPolynomialCoefficient); Geom2dConvert_reparameterise_evaluator ev (aPolynomialCoefficient);
// BSplCLib::FunctionReparameterise(reparameterise_evaluator,
BSplCLib::FunctionReparameterise(ev, BSplCLib::FunctionReparameterise(ev,
Curve1->Degree(), Curve1->Degree(),
Curve1FlatKnots, Curve1FlatKnots,
@ -1350,7 +1333,6 @@ void Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
aStatus aStatus
); );
TColStd_Array1OfReal NewWeights(1, FlatKnots.Length() - (aNewCurveDegree + 1)); TColStd_Array1OfReal NewWeights(1, FlatKnots.Length() - (aNewCurveDegree + 1));
// BSplCLib::FunctionReparameterise(reparameterise_evaluator,
BSplCLib::FunctionReparameterise(ev, BSplCLib::FunctionReparameterise(ev,
Curve1->Degree(), Curve1->Degree(),
Curve1FlatKnots, Curve1FlatKnots,

View File

@ -0,0 +1,9 @@
puts "================================"
puts "0033179: Modeling Algorithms - Crash in in ShapeFix_Shape with the attached object, when healing for fixing SameParameterFlag"
puts "================================"
restore [locate_data_file bug33179.brep] s
fsameparameter s
checkshape s