mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-27 09:50:34 +05:00
0020763: EDF 1313 GEOM : Fillet 1D can crash the application and the MakeWire tolerance is not dumped
This commit is contained in:
parent
7780c41f49
commit
72e616511b
@ -117,10 +117,9 @@ static Standard_Boolean isRadiusIntersected(const Handle(Geom2d_Curve)& theCurve
|
||||
for(a = anInter.NbPoints(); a > 0; a--)
|
||||
{
|
||||
aPoint = anInter.Point(a);
|
||||
if (aPoint.Distance(theStart) < aTol)
|
||||
if (!theStartConnected)
|
||||
return Standard_True;
|
||||
if (aPoint.Distance(theEnd) < aTol)
|
||||
if ( aPoint.Distance(theStart) < aTol && !theStartConnected )
|
||||
return Standard_True;
|
||||
if (aPoint.Distance(theEnd) < aTol * 200)
|
||||
return Standard_True;
|
||||
if (gp_Vec2d(aPoint, theStart).IsOpposite(gp_Vec2d(aPoint, theEnd), anAngTol))
|
||||
return Standard_True;
|
||||
@ -345,7 +344,7 @@ void GEOMImpl_Fillet1d::performNewton(GEOMImpl_Fillet1dPoint* theLeft,
|
||||
}
|
||||
|
||||
Standard_Real aDX = theRight->GetParam() - theLeft->GetParam();
|
||||
if (aDX < gp::Resolution()/*Precision::Confusion() / 1000000.*/)
|
||||
if ( aDX < Precision::Confusion() / 1000000.)
|
||||
{
|
||||
a = theRight->HasSolution(myRadius);
|
||||
if (a)
|
||||
@ -361,11 +360,14 @@ void GEOMImpl_Fillet1d::performNewton(GEOMImpl_Fillet1dPoint* theLeft,
|
||||
{
|
||||
Standard_Integer aNear = theLeft->GetNear(a);
|
||||
|
||||
Standard_Real aA = (theRight->GetDiff(aNear) - theLeft->GetDiff(a)) / aDX;
|
||||
Standard_Real aA = (theRight->GetDiff(aNear) - theLeft->GetDiff(a)) / aDX;
|
||||
Standard_Real aB = theLeft->GetDiff(a) - aA * theLeft->GetParam();
|
||||
Standard_Real aC = theLeft->GetValue(a) - theLeft->GetDiff(a) * theLeft->GetParam() +
|
||||
aA * theLeft->GetParam() * theLeft->GetParam() / 2.0;
|
||||
Standard_Real aDet = aB * aB - 2.0 * aA * aC;
|
||||
|
||||
if ( fabs(aDet) < gp::Resolution() )
|
||||
continue;
|
||||
|
||||
if (fabs(aA) < Precision::Confusion())
|
||||
{ // linear case
|
||||
@ -573,10 +575,10 @@ Standard_Boolean GEOMImpl_Fillet1dPoint::ComputeDifference(GEOMImpl_Fillet1dPoin
|
||||
for(a = 1; a <= myV.Length(); a++)
|
||||
{
|
||||
aDY = thePoint->myV.Value(a) - myV.Value(a);
|
||||
if (aDiffsSet)
|
||||
myD.SetValue(a, aDY / aDX);
|
||||
else
|
||||
myD.Append(aDY / aDX);
|
||||
if ( aDiffsSet )
|
||||
myD.SetValue(a, fabs(aDX) > gp::Resolution() ? (aDY/aDX) : 0);
|
||||
else
|
||||
myD.Append( fabs(aDX) > gp::Resolution() ? (aDY/aDX) : 0);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
@ -591,12 +593,14 @@ Standard_Boolean GEOMImpl_Fillet1dPoint::ComputeDifference(GEOMImpl_Fillet1dPoin
|
||||
}
|
||||
if (aDiffsSet)
|
||||
{
|
||||
if (fabs(aDY / aDX) < fabs(myD.Value(a)))
|
||||
if ( fabs(aDX) > gp::Resolution() && fabs(aDY / aDX) < fabs(myD.Value(a)))
|
||||
myD.SetValue(a, aDY / aDX);
|
||||
else
|
||||
myD.SetValue(a, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
myD.Append(aDY / aDX);
|
||||
myD.Append( fabs(aDX) > gp::Resolution() ? aDY/aDX : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,7 +668,7 @@ void GEOMImpl_Fillet1dPoint::FilterPoints(GEOMImpl_Fillet1dPoint* thePoint)
|
||||
|
||||
if (aNear)
|
||||
{
|
||||
if (fabs(aDiff / aDX) > 1.e+7)
|
||||
if ( fabs(aDX) < gp::Resolution() || fabs(aDiff / aDX) > 1.e+7)
|
||||
{
|
||||
aNear = 0;
|
||||
}
|
||||
|
@ -155,6 +155,8 @@ Standard_Integer GEOMImpl_Fillet1dDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
Handle(GEOM_Function) aRefShape = aCI.GetShape();
|
||||
TopoDS_Shape aShape = aRefShape->GetValue();
|
||||
if (aShape.IsNull())
|
||||
return 0;
|
||||
if (aShape.ShapeType() != TopAbs_WIRE)
|
||||
Standard_ConstructionError::Raise("Wrong arguments: polyline as wire must be given");
|
||||
|
||||
@ -162,6 +164,9 @@ Standard_Integer GEOMImpl_Fillet1dDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
double rad = aCI.GetR();
|
||||
|
||||
if ( rad < Precision::Confusion())
|
||||
return 0;
|
||||
|
||||
// collect vertices for make fillet
|
||||
TopTools_ListOfShape aVertexList;
|
||||
TopTools_MapOfShape mapShape;
|
||||
|
@ -276,7 +276,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeWire
|
||||
pd << ", " << (*it++);
|
||||
}
|
||||
}
|
||||
pd << "])";
|
||||
pd << "], " << theTolerance << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aWire;
|
||||
|
Loading…
Reference in New Issue
Block a user