return Standard_False;
}
-
IntTools_ListOfCurveRangeSample aListCurveRangeSort;
IntTools_ListOfSurfaceRangeSample aListSurfaceRangeSort;
for(indIt = nMinIndex ; indIt <= nMaxIndex; indIt++) {
if(myRangeManager.Flag(indIt) == 2) {
bFound = Standard_True;
- break;
+ break;
}
}
gp_Pnt aPnt;
Standard_Real aParU;
Standard_Real aParV;
+ gp_Vec aDU, aDV;
+ Standard_Real du = 0, dv = 0;
+ Standard_Boolean isCalcDefl = aNbGridPnts[0] < 30 && aNbGridPnts[1] < 30;
+
+ Bnd_Box aGridBox, anExtBox;
for (i = 1; i <= aNbGridPnts[0]; i++) {
aParU = theSurfaceData.GetUParam(i);
+
+ if (isCalcDefl && i < aNbGridPnts[0])
+ {
+ du = 0.5 * (theSurfaceData.GetUParam(i + 1) - aParU);
+ }
for (j = 1; j <= aNbGridPnts[1]; j++) {
aParV = theSurfaceData.GetVParam(j);
+
+ if (isCalcDefl)
+ {
+ theSurf->D1(aParU, aParV, aPnt, aDU, aDV);
+ }
+ else
+ {
+ theSurf->D0(aParU, aParV, aPnt);
+ }
- theSurf->D0(aParU, aParV, aPnt);
theSurfaceData.SetGridPoint(i, j, aPnt);
+ //
+ if (isCalcDefl)
+ {
+ aGridBox.Add(aPnt);
+ if (i < aNbGridPnts[0] && j < aNbGridPnts[1])
+ {
+ dv = 0.5 * (theSurfaceData.GetVParam(j + 1) - aParV);
+ gp_Vec aShift = du * aDU + dv * aDV;
+ aPnt.Translate(aShift);
+ anExtBox.Add(aPnt);
+ }
+ }
}
}
// Compute deflection.
Standard_Real aDef = 0.;
-// Standard_Real aDefLin;
-// Standard_Real aParMid;
-// Standard_Real aParConst;
-// Standard_Real aDistPP;
-// gp_Pnt aPntMid;
-// gp_Vec aVec;
-// gp_XYZ aCoord;
-
-// // Compute DU deflection.
-// for (i = 1; i < aNbGridPnts[0]; i++) {
-// aParMid = 0.5*(theSurfaceData.GetUParam(i + 1) +
-// theSurfaceData.GetUParam(i));
-
-// for (j = 1; j <= aNbGridPnts[1]; j++) {
-// const gp_Pnt &thePnt1 = theSurfaceData.GetGridPoint(i, j);
-// const gp_Pnt &thePnt2 = theSurfaceData.GetGridPoint(i + 1, j);
-
-// aVec.SetXYZ(thePnt2.XYZ().Subtracted(thePnt1.XYZ()));
-// aDistPP = aVec.Magnitude();
-
-// if (aDistPP > theTolerance) {
-// // Computation of a distance of a middle point from the line P1 - P2.
-// aParConst = theSurfaceData.GetVParam(j);
-// theSurf->D0(aParMid, aParConst, aPntMid);
-// aCoord = aPntMid.XYZ();
-// aCoord.Subtract(thePnt1.XYZ());
-// aCoord.Cross (aVec.XYZ());
-// aCoord.Divide(aDistPP);
-// aDefLin = aCoord.Modulus();
-
-// if (aDefLin > aDef)
-// aDef = aDefLin;
-// }
-// }
-// }
-
-// // Compute DV deflection.
-// for (j = 1; j < aNbGridPnts[1]; j++) {
-// aParMid = 0.5*(theSurfaceData.GetVParam(j + 1) +
-// theSurfaceData.GetVParam(j));
-
-// for (i = 1; i <= aNbGridPnts[0]; i++) {
-// const gp_Pnt &thePnt1 = theSurfaceData.GetGridPoint(i, j);
-// const gp_Pnt &thePnt2 = theSurfaceData.GetGridPoint(i, j + 1);
-
-// aVec.SetXYZ(thePnt2.XYZ().Subtracted(thePnt1.XYZ()));
-// aDistPP = aVec.Magnitude();
-
-// if (aDistPP > theTolerance) {
-// // Computation of a distance of a middle point from the line P1 - P2.
-// aParConst = theSurfaceData.GetUParam(i);
-// theSurf->D0(aParConst, aParMid, aPntMid);
-// aCoord = aPntMid.XYZ();
-// aCoord.Subtract(thePnt1.XYZ());
-// aCoord.Cross (aVec.XYZ());
-// aCoord.Divide(aDistPP);
-// aDefLin = aCoord.Modulus();
-
-// if (aDefLin > aDef)
-// aDef = aDefLin;
-// }
-// }
-// }
+ if (isCalcDefl)
+ {
+ Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
+ Standard_Real xmin1, ymin1, zmin1, xmax1, ymax1, zmax1;
+ aGridBox.Get(xmin, ymin, zmin, xmax, ymax, zmax);
+ anExtBox.Get(xmin1, ymin1, zmin1, xmax1, ymax1, zmax1);
+ Standard_Integer anExtCount = 0;
+ if (xmin1 < xmin)
+ {
+ aDef = Max(xmin - xmin1, aDef);
+ anExtCount++;
+ }
+ if (ymin1 < ymin)
+ {
+ aDef = Max(ymin - ymin1, aDef);
+ anExtCount++;
+ }
+ if (zmin1 < zmin)
+ {
+ aDef = Max(zmin - zmin1, aDef);
+ anExtCount++;
+ }
+ if (xmax1 > xmax)
+ {
+ aDef = Max(xmax1 - xmax, aDef);
+ anExtCount++;
+ }
+ if (ymax1 > ymax)
+ {
+ aDef = Max(ymax1 - ymax, aDef);
+ anExtCount++;
+ }
+ if (zmax1 > zmax)
+ {
+ aDef = Max(zmax1 - zmax, aDef);
+ anExtCount++;
+ }
+ if (anExtCount < 3)
+ {
+ aDef /= 2.;
+ }
+ }
if (theTolerance > aDef)
- aDef = theTolerance;
+ aDef = 2. * theTolerance;
- aDef *= 2.;
theSurfaceData.SetGridDeflection(aDef);
}