mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024206: Exception is raised in the STEP loopback tests.
Fixed several cases of potentially uninitialized variables in Shape Healing. Corrections to avoid warning for unused variable distmini and to avoid regression for case bug22805
This commit is contained in:
parent
8da5fb19a9
commit
62f225930c
@ -176,27 +176,46 @@ Standard_Real ShapeAnalysis_Curve::Project(const Adaptor3d_Curve& C3D,
|
||||
const Standard_Boolean AdjustToEnds) const
|
||||
|
||||
{
|
||||
|
||||
Standard_Real uMin = C3D.FirstParameter();
|
||||
Standard_Real uMax = C3D.LastParameter();
|
||||
Standard_Real distmin;
|
||||
if (!Precision::IsInfinite(uMin)||!Precision::IsInfinite(uMax)) {
|
||||
|
||||
if (Precision::IsInfinite(uMin) && Precision::IsInfinite(uMax))
|
||||
return ProjectAct(C3D, P3D, preci, proj, param);
|
||||
|
||||
Standard_Real distmin_L = Precision::Infinite(), distmin_H = Precision::Infinite();
|
||||
Standard_Real prec = ( AdjustToEnds ? preci : Precision::Confusion() ); //:j8 abv 10 Dec 98: tr10_r0501_db.stp #9423: protection against densing of points near one end
|
||||
gp_Pnt LowBound = C3D.Value(uMin);
|
||||
gp_Pnt HigBound = C3D.Value(uMax);
|
||||
distmin = LowBound.Distance(P3D);
|
||||
if (distmin <= prec) {
|
||||
distmin_L = LowBound.Distance(P3D);
|
||||
distmin_H = HigBound.Distance(P3D);
|
||||
|
||||
if (distmin_L <= prec) {
|
||||
param = uMin;
|
||||
proj = LowBound;
|
||||
return distmin;
|
||||
return distmin_L;
|
||||
}
|
||||
distmin = HigBound.Distance(P3D);
|
||||
if (distmin <= prec) {
|
||||
|
||||
if (distmin_H <= prec) {
|
||||
param = uMax;
|
||||
proj = HigBound;
|
||||
return distmin;
|
||||
return distmin_H;
|
||||
}
|
||||
|
||||
Standard_Real distProj = ProjectAct(C3D, P3D, preci, proj, param);
|
||||
if( distProj < distmin_L + Precision::Confusion() && distProj < distmin_H + Precision::Confusion())
|
||||
return distProj;
|
||||
|
||||
if( distmin_L < distmin_H)
|
||||
{
|
||||
param = uMin;
|
||||
proj = LowBound;
|
||||
return distmin_L;
|
||||
}
|
||||
return ProjectAct(C3D, P3D, preci, proj, param);
|
||||
param = uMax;
|
||||
proj = HigBound;
|
||||
return distmin_H;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -212,6 +231,7 @@ Standard_Real ShapeAnalysis_Curve::ProjectAct(const Adaptor3d_Curve& C3D,
|
||||
|
||||
{
|
||||
Standard_Boolean OK = Standard_False;
|
||||
param = 0.;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
Extrema_ExtPC myExtPC(P3D,C3D);
|
||||
@ -238,7 +258,7 @@ Standard_Real ShapeAnalysis_Curve::ProjectAct(const Adaptor3d_Curve& C3D,
|
||||
//szv#4:S4163:12Mar99 moved
|
||||
Standard_Real uMin = C3D.FirstParameter(), uMax = C3D.LastParameter();
|
||||
Standard_Boolean closed = Standard_False; // si on franchit les bornes ...
|
||||
Standard_Real distmin = RealLast(), valclosed = 0.;
|
||||
Standard_Real distmin = Precision::Infinite(), valclosed = 0.;
|
||||
Standard_Real aModParam = param;
|
||||
Standard_Real aModMin = distmin;
|
||||
|
||||
@ -386,7 +406,7 @@ Standard_Real ShapeAnalysis_Curve::NextProject(const Standard_Real paramPrev,
|
||||
{
|
||||
Standard_Real uMin = (cf < cl ? cf : cl);
|
||||
Standard_Real uMax = (cf < cl ? cl : cf);
|
||||
Standard_Real distmin;
|
||||
Standard_Real distmin = Precision::Infinite();
|
||||
if (C3D->IsKind(STANDARD_TYPE(Geom_BoundedCurve))) {
|
||||
Standard_Real prec = ( AdjustToEnds ? preci : Precision::Confusion() ); //:j8 abv 10 Dec 98: tr10_r0501_db.stp #9423: protection against densing of points near one end
|
||||
gp_Pnt LowBound = C3D->Value(uMin);
|
||||
|
@ -81,6 +81,7 @@ void ShapeFix_EdgeProjAux::Init (const TopoDS_Face& F,
|
||||
{
|
||||
myFace = F;
|
||||
myEdge = E;
|
||||
myFirstParam = myLastParam = 0.;
|
||||
myFirstDone = myLastDone = Standard_False;
|
||||
}
|
||||
|
||||
@ -232,7 +233,8 @@ void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci)
|
||||
Handle(Geom_Surface) theSurface = BRep_Tool::Surface(myFace);
|
||||
Handle(Geom2d_Curve) theCurve2d = BRep_Tool::CurveOnSurface(myEdge, myFace, cf, cl);
|
||||
if ( theCurve2d.IsNull() ) return; //:r5 abv 6 Apr 99: ec_turbine-A.stp, #4313
|
||||
|
||||
myFirstParam = cf;
|
||||
myLastParam = cl;
|
||||
TopoDS_Vertex V1,V2;
|
||||
TopExp::Vertices(myEdge, V1, V2);
|
||||
gp_Pnt Pt1,Pt2;
|
||||
@ -350,7 +352,8 @@ void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
myFirstParam = cf;
|
||||
myLastParam = cl;
|
||||
Geom2dAdaptor_Curve CA = Geom2dAdaptor_Curve(theCurve2d,cf,cl);
|
||||
Handle(Geom2dAdaptor_HCurve) myHCur = new Geom2dAdaptor_HCurve(CA);
|
||||
|
||||
@ -361,15 +364,34 @@ void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci)
|
||||
// ----------------------------------------------
|
||||
Standard_Real Uinf = COnS.FirstParameter();
|
||||
Standard_Real Usup = COnS.LastParameter();
|
||||
|
||||
Standard_Real w1,w2;
|
||||
myFirstDone = myLastDone = Standard_True;
|
||||
Standard_Real w1 = 0., w2 = 0.;
|
||||
ShapeAnalysis_Curve sac;
|
||||
gp_Pnt pnt;
|
||||
Standard_Real dist = sac.Project(COnS,Pt1,preci,pnt,w1,Standard_False);
|
||||
if (dist > preci) return;
|
||||
dist = sac.Project(COnS,Pt2,preci,pnt,w2,Standard_False);
|
||||
if (dist > preci) return;
|
||||
//if distance is infinite then projection is not performed
|
||||
if( Precision::IsInfinite(dist))
|
||||
{
|
||||
myFirstDone = Standard_False;
|
||||
myLastDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
if (dist > preci)
|
||||
return;
|
||||
dist = sac.Project(COnS,Pt2,preci,pnt,w2,Standard_False);
|
||||
if( Precision::IsInfinite(dist))
|
||||
{
|
||||
myLastDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
if (dist > preci)
|
||||
return;
|
||||
if(fabs(w1 - w2) < Precision::PConfusion())
|
||||
{
|
||||
if(!theSurface->IsUPeriodic() && !theSurface->IsVPeriodic())
|
||||
return;
|
||||
}
|
||||
myFirstParam = w1;
|
||||
myLastParam = w2;
|
||||
myFirstDone = myLastDone = Standard_True;
|
||||
|
Loading…
x
Reference in New Issue
Block a user