1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0029769: Uninitialized data with BSplCLib_Cache, BSplSLib_Cache

Implementation of classes BSplCLib_Cache and BSplSLib_Cache is revised:
- Common functionality dealing with spans along one parametric direction is separated to new struct BSplCLib_CacheParams
- Empty constructors are removed; copying is prohibited
- Code reconsidering degree and other parameters on each call to BuildCache() is eliminated; curve parameters must be the same in constructor and all calls to BuildCache()
- Extra call to BuildCache() from constructor is eliminated
This commit is contained in:
abv
2018-06-10 22:40:12 +03:00
committed by bugmaster
parent 3388cf17dc
commit 0a96e0bbc4
9 changed files with 279 additions and 382 deletions

View File

@@ -556,20 +556,18 @@ void Geom2dAdaptor_Curve::RebuildCache(const Standard_Real theParameter) const
Standard_Integer aDeg = aBezier->Degree();
TColStd_Array1OfReal aFlatKnots(BSplCLib::FlatBezierKnots(aDeg), 1, 2 * (aDeg + 1));
if (myCurveCache.IsNull())
myCurveCache = new BSplCLib_Cache(aDeg, aBezier->IsPeriodic(), aFlatKnots,
aBezier->Poles(), aBezier->Weights());
myCurveCache->BuildCache(theParameter, aDeg, aBezier->IsPeriodic(), aFlatKnots,
aBezier->Poles(), aBezier->Weights());
myCurveCache = new BSplCLib_Cache (aDeg, aBezier->IsPeriodic(), aFlatKnots,
aBezier->Poles(), aBezier->Weights());
myCurveCache->BuildCache (theParameter, aFlatKnots, aBezier->Poles(), aBezier->Weights());
}
else if (myTypeCurve == GeomAbs_BSplineCurve)
{
// Create cache for B-spline
if (myCurveCache.IsNull())
myCurveCache = new BSplCLib_Cache(myBSplineCurve->Degree(), myBSplineCurve->IsPeriodic(),
myCurveCache = new BSplCLib_Cache (myBSplineCurve->Degree(), myBSplineCurve->IsPeriodic(),
myBSplineCurve->KnotSequence(), myBSplineCurve->Poles(), myBSplineCurve->Weights());
myCurveCache->BuildCache(theParameter, myBSplineCurve->Degree(),
myBSplineCurve->IsPeriodic(), myBSplineCurve->KnotSequence(),
myBSplineCurve->Poles(), myBSplineCurve->Weights());
myCurveCache->BuildCache (theParameter, myBSplineCurve->KnotSequence(),
myBSplineCurve->Poles(), myBSplineCurve->Weights());
}
}