Archived issue #0023504
The function Adaptor3d_TopolTool::BSplSamplePnts leaves uninitialized items in myUPars and myVPars arrays
Description
The function Adaptor3d_TopolTool::BSplSamplePnts leaves uninitialized items in myUPars and myVPars arrays, which are later used by IntPolyh_MaillageAffinage::FillArrayOfPnt function and this triggers an OuOfRange exception in Geom_BSplineSurface::ValidateCache (see attached screenshot of the debugger).
The following code (part of Adaptor3d_TopolTool::BSplSamplePnts function) creates an array myUPars of the size myNbSamplesU, but if some item in anUFlg array is set to false, it does not initializes all of the items in myUPars:
//
// U
bFlag=(myNbSamplesU < theNUmin);
if (bFlag) {
myNbSamplesU=nbsu;
}
//
myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU);
//
for(j = 0, i = 1; i <= nbsu; ++i) {
if (bFlag) {
myUPars->SetValue(i,anUPars(i));
}
else {
if(anUFlg(i)) {
++j;
myUPars->SetValue(j,anUPars(i));
}
}
}
//
I've replaced this code with the following one that solved the problem for me:
//
// U
myNbSamplesU = nbsu;
if (bFlag)
{
myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU);
for (i = 1; i <= nbsu; ++i)
{
myUPars->SetValue(i,anUPars(i));
}
}
else
{
for (i = 1; i <= nbsu; ++i)
{
if (!anUFlg(i))
{
--myNbSamplesU;
}
}
myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU);
for(j = 0, i = 1; i <= nbsu; ++i)
{
if(anUFlg(i))
{
++j;
myUPars->SetValue(j, anUPars(i));
}
}
}
//
The same applies for V parameters.
The following code (part of Adaptor3d_TopolTool::BSplSamplePnts function) creates an array myUPars of the size myNbSamplesU, but if some item in anUFlg array is set to false, it does not initializes all of the items in myUPars:
//
// U
bFlag=(myNbSamplesU < theNUmin);
if (bFlag) {
myNbSamplesU=nbsu;
}
//
myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU);
//
for(j = 0, i = 1; i <= nbsu; ++i) {
if (bFlag) {
myUPars->SetValue(i,anUPars(i));
}
else {
if(anUFlg(i)) {
++j;
myUPars->SetValue(j,anUPars(i));
}
}
}
//
I've replaced this code with the following one that solved the problem for me:
//
// U
myNbSamplesU = nbsu;
if (bFlag)
{
myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU);
for (i = 1; i <= nbsu; ++i)
{
myUPars->SetValue(i,anUPars(i));
}
}
else
{
for (i = 1; i <= nbsu; ++i)
{
if (!anUFlg(i))
{
--myNbSamplesU;
}
}
myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU);
for(j = 0, i = 1; i <= nbsu; ++i)
{
if(anUFlg(i))
{
++j;
myUPars->SetValue(j, anUPars(i));
}
}
}
//
The same applies for V parameters.
Public activity
1 archived note
Participants are labeled by their role within this record.
This bug has been fixed by the patch to 23472