I believe that there is a bug in the GeomAPI_Interpolate::Perform() method.
This code runs without any problems:
#include "TColStd_HArray1OfReal.hxx"
#include "TColgp_HArray1OfPnt.hxx"
#include "GeomAPI_Interpolate.hxx"
#include "Geom_BSplineCurve.hxx"
#include "Geom_Circle.hxx"
int main()
{
Handle(TColgp_HArray1OfPnt) hardcoded_points {new TColgp_HArray1OfPnt(1, 4)};
(*hardcoded_points)[1] = {gp_Pnt(0, 0, 0)};
(*hardcoded_points)[2] = {gp_Pnt(1, 0, 0)};
(*hardcoded_points)[3] = {gp_Pnt(1.5, 0, 0)};
(*hardcoded_points)[4] = {gp_Pnt(4, 0, 0)};
GeomAPI_Interpolate interpolation(hardcoded_points, false, .01);
interpolation.Perform();
interpolation.IsDone();
Handle(Geom_BSplineCurve) interpolated_curve {interpolation.Curve()};
}
But the following code fails at runtime, due to a Standard_OutOfRange Exception issued from (somewhere inside) the Perform() method. Notice that the only difference is the choice of the start and end indices.
#include "TColStd_HArray1OfReal.hxx"
#include "TColgp_HArray1OfPnt.hxx"
#include "GeomAPI_Interpolate.hxx"
#include "Geom_BSplineCurve.hxx"
#include "Geom_Circle.hxx"
int main()
{
Handle(TColgp_HArray1OfPnt) hardcoded_points {new TColgp_HArray1OfPnt(0, 3)};
(*hardcoded_points)[0] = {gp_Pnt(0, 0, 0)};
(*hardcoded_points)[1] = {gp_Pnt(1, 0, 0)};
(*hardcoded_points)[2] = {gp_Pnt(1.5, 0, 0)};
(*hardcoded_points)[3] = {gp_Pnt(4, 0, 0)};
GeomAPI_Interpolate interpolation(hardcoded_points, false, .01);
interpolation.Perform();
interpolation.IsDone();
Handle(Geom_BSplineCurve) interpolated_curve {interpolation.Curve()};
}
I did not debug the source of the exception because I'm having trouble compiling the library with debug symbols.
I don't believe that the documentation says that the starting array index must be 1.