MantisBT - Community
View Issue Details
0023050Community[OCCT] OCCT:Modeling Datapublic2012-03-31 14:182012-04-02 13:33
Ahmed Sherif 
jgv 
highcrash 
assignedopen 
WindowsVC++ 201032 bit
[OCCT] 6.5.1 
[OCCT] Unscheduled 
0023050: Geom2d_BSplineCurve InsertPoleAfter
File Geom2d_BSplineCurve.cxx, line 539.
function InsertPoleAfter(const Standard_Integer Index,
 const gp_Pnt2d& P,
 const Standard_Real Weight) ;

calling this method cause a run time error.
1- at line 561 the for loop:(wrong implementation)
for (i = 1; i < nbknots; i++) {
    newknots (i) = cknots(i);
  }

2- at line 565:(wrong implementation)
newknots (nbknots+1) = 2 * newknots (nbknots) - newknots(nbknots-1);
since newknots just holding a garbage.

3- at line 575:(run time error)
newmults (nbknots+1) = cmults(nbknots+1);
at this line causes a run time error because (cmults size = nbknots) and access
cmults(nbknots+1) makes an error.

Solution:
1- for (i = 1; i <= nbknots; i++) { //changed from < only to <=
    newknots (i) = cknots(i);
  }

2- newknots (nbknots+1) = 2 * cknots (nbknots) - cknots(nbknots-1);
// instead of newknots

3- newmults (nbknots+1) = cmults(nbknots); // instead of +1
- I found this bug at November 2011, sorry for delay.
- For method IncreaseDegree at Geom2d_BSplineCurve it calls static method
IncreassDegree from BSplCLib while the BSplCLib cdl file documented that you use this method only for BezierCurve. so what kind of BsplineCurve I need to test that method because it gives run time error sometimes as well or garbage results.
Thanks in advance.

       Ahmed Sherif
  
No tags attached.
Issue History
2012-03-31 14:18Ahmed SherifNew Issue
2012-03-31 14:18Ahmed SherifAssigned To => jgv
2012-04-02 13:32abvNote Added: 0020236
2012-04-02 13:32abvStatusnew => assigned
2012-04-02 13:33abvTarget Version => Unscheduled

Notes
(0020236)
abv   
2012-04-02 13:32   
Note that method InsertPoleAfter() of Geom2d_BSplineCurve is not used anywhere in OCCT; even tests call only corresponding methods of bezier curves (see GeomliteTest_CurveCommands.cxx, command insertpole). Thus we need to extend this command for testing this function, and create a test case, before integrating the fix.

The general question is whether this method is needed for bspline at all. In bezier curves, it adds a pole by increasing degree, and this is the only way to add more degrees of freedom for bezier. In bspline, adding degrees of freedom should be rather achieved by calling InsertKnots().