how to interpolate the point array to get a curve?

I know there is a class GeomAPI_Interpolate that can interpolate a BsplineCurve
passing through an array of points. But I want using linear interpolation to interpolate an array of points to get a curve. thank you in advance!

LI's picture

TColgp_Array1OfPnt aPnts(1,nn);
for (j=1;j<=nn;j++)
{
aPnts.SetValue(j,gp); //user defined values
}
Handle(Geom_BSplineCurve) SPL = GeomAPI_PointsToBSpline(aPnts).Curve();