mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
0022873: Minor correction in ShapeConstruct_ProjectCurveOnSurface.cxx
This commit is contained in:
parent
34781c33af
commit
7ae65f0d8b
@ -1159,28 +1159,29 @@ Handle(Geom_Curve) ShapeConstruct_ProjectCurveOnSurface::InterpolateCurve3d(cons
|
|||||||
// will store 0 when the point is to be removed, 1 otherwise
|
// will store 0 when the point is to be removed, 1 otherwise
|
||||||
TColStd_Array1OfInteger tmpParam(firstElem, lastElem);
|
TColStd_Array1OfInteger tmpParam(firstElem, lastElem);
|
||||||
for (i = firstElem; i<=lastElem ; i++) tmpParam.SetValue(i,1);
|
for (i = firstElem; i<=lastElem ; i++) tmpParam.SetValue(i,1);
|
||||||
Standard_Real DistMin = RealLast();
|
Standard_Real DistMin2 = RealLast();
|
||||||
gp_Pnt Prev = points->Value (lastValid);
|
gp_Pnt Prev = points->Value (lastValid);
|
||||||
gp_Pnt Curr;
|
gp_Pnt Curr;
|
||||||
for (i = firstElem + 1; i <= lastElem ; i ++) {
|
for (i = firstElem + 1; i <= lastElem ; i ++) {
|
||||||
Curr = points->Value(i);
|
Curr = points->Value(i);
|
||||||
Standard_Real CurDist = Prev.Distance(Curr);
|
Standard_Real CurDist2 = Prev.SquareDistance(Curr);
|
||||||
if (CurDist == 0.) { // test 0 ???
|
if (CurDist2 < gp::Resolution()) { // test 0
|
||||||
nbPntDropped ++;
|
nbPntDropped ++;
|
||||||
if ( i == lastElem ) tmpParam.SetValue(lastValid, 0); // last point kept
|
if ( i == lastElem ) tmpParam.SetValue(lastValid, 0); // last point kept
|
||||||
else tmpParam.SetValue(i, 0); // current dropped, lastValid unchanged
|
else tmpParam.SetValue(i, 0); // current dropped, lastValid unchanged
|
||||||
} else {
|
} else {
|
||||||
if (CurDist < DistMin) { DistMin = CurDist; preci = DistMin; }
|
if (CurDist2 < DistMin2)
|
||||||
|
DistMin2 = CurDist2;
|
||||||
// lastValid becomes the current (i.e. i)
|
// lastValid becomes the current (i.e. i)
|
||||||
lastValid = i;
|
lastValid = i;
|
||||||
Prev = Curr;
|
Prev = Curr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nbPntDropped == 0) {
|
if (DistMin2 < RealLast())
|
||||||
preci = preci * 0.9; // preci est la distance min entre les points
|
preci = 0.9 * Sqrt (DistMin2); // preci est la distance min entre les points on la reduit un peu
|
||||||
// on la reduit un peu
|
if (nbPntDropped == 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cout << "Warning : removing 3d points for interpolation" << endl;
|
cout << "Warning : removing 3d points for interpolation" << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -1206,7 +1207,6 @@ Handle(Geom_Curve) ShapeConstruct_ProjectCurveOnSurface::InterpolateCurve3d(cons
|
|||||||
}
|
}
|
||||||
points = newPnts;
|
points = newPnts;
|
||||||
params = newParams;
|
params = newParams;
|
||||||
preci = preci * 0.9; // preci est la distance min entre les points
|
|
||||||
// on la reduit un peu
|
// on la reduit un peu
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1230,27 +1230,29 @@ Handle(Geom_Curve) ShapeConstruct_ProjectCurveOnSurface::InterpolateCurve3d(cons
|
|||||||
for (i = firstElem; i<=lastElem ; i++) {
|
for (i = firstElem; i<=lastElem ; i++) {
|
||||||
tmpParam.SetValue(i,1);
|
tmpParam.SetValue(i,1);
|
||||||
}
|
}
|
||||||
Standard_Real DistMin = RealLast();
|
Standard_Real DistMin2 = RealLast();
|
||||||
gp_Pnt2d Prev = points->Value(lastValid);
|
gp_Pnt2d Prev = points->Value(lastValid);
|
||||||
gp_Pnt2d Curr;
|
gp_Pnt2d Curr;
|
||||||
for (i = firstElem + 1; i<=lastElem ; i++) {
|
for (i = firstElem + 1; i<=lastElem ; i++) {
|
||||||
Curr = points->Value(i);
|
Curr = points->Value(i);
|
||||||
Standard_Real CurDist = Prev.Distance(Curr);
|
Standard_Real CurDist2 = Prev.SquareDistance(Curr);
|
||||||
if (CurDist == 0.) { // test 0 ???
|
if (CurDist2 < gp::Resolution()) { // test 0
|
||||||
nbPntDropped ++;
|
nbPntDropped ++;
|
||||||
if ( i == lastElem ) tmpParam.SetValue(lastValid, 0); // last point kept
|
if ( i == lastElem ) tmpParam.SetValue(lastValid, 0); // last point kept
|
||||||
else tmpParam.SetValue(i, 0); // current dropped, lastValid unchanged
|
else tmpParam.SetValue(i, 0); // current dropped, lastValid unchanged
|
||||||
} else {
|
} else {
|
||||||
if (CurDist < DistMin) { DistMin = CurDist; preci = DistMin; }
|
if (CurDist2 < DistMin2)
|
||||||
|
DistMin2 = CurDist2;
|
||||||
// lastValid becomes the current (i.e. i)
|
// lastValid becomes the current (i.e. i)
|
||||||
lastValid = i;
|
lastValid = i;
|
||||||
Prev = Curr;
|
Prev = Curr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nbPntDropped == 0) {
|
if (DistMin2 < RealLast())
|
||||||
preci = preci * 0.9;
|
preci = 0.9 * Sqrt (DistMin2);
|
||||||
|
if (nbPntDropped == 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cout << "Warning : removing 2d points for interpolation" << endl;
|
cout << "Warning : removing 2d points for interpolation" << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -1291,7 +1293,6 @@ Handle(Geom_Curve) ShapeConstruct_ProjectCurveOnSurface::InterpolateCurve3d(cons
|
|||||||
}
|
}
|
||||||
points = newPnts;
|
points = newPnts;
|
||||||
params = newParams;
|
params = newParams;
|
||||||
preci = preci * 0.9;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user