I just start learn the opencascade and try to use it to genreate a degree 3 b-spline
my Goal is to create a clamped b-spline with degree 3 and contain 9 knots and five control points
header files here
#include <TColStd_Array1OfReal.hxx>
#include <Geom_BSplineCurve.hxx>
#include <gp_Pnt.hxx>
Create a handle pointer of B-spline with degree 3 set five control points every knots appear once
Handle(Geom_BSplineCurve) CreateBSplineCurve() //Create a handle pointer of B-spline with degree 3
{
TColgp_Array1OfPnt controlPoints(1, 5); //set five control points
controlPoints.SetValue(1, gp_Pnt(1, 1, 0));
controlPoints.SetValue(2, gp_Pnt(2, 3, 0));
controlPoints.SetValue(3, gp_Pnt(4, 5, 0));
controlPoints.SetValue(4, gp_Pnt(7, 3, 0));
controlPoints.SetValue(5, gp_Pnt(9, 6, 0));
TColStd_Array1OfReal knots(1, 9); // set 9 knots
knots.SetValue(1, 0.0);
knots.SetValue(2, 0.0);
knots.SetValue(3, 0.0);
knots.SetValue(4, 0.0);
knots.SetValue(5, 0.5);
knots.SetValue(6, 1.0);
knots.SetValue(7, 1.0);
knots.SetValue(8, 1.0);
knots.SetValue(9, 1.0);
TColStd_Array1OfInteger multiplicities(1,9); //every knots appear once
multiplicities.SetValue(1, 1);
multiplicities.SetValue(2, 1);
multiplicities.SetValue(3, 1);
multiplicities.SetValue(4, 1);
multiplicities.SetValue(5, 1);
multiplicities.SetValue(6, 1);
multiplicities.SetValue(7, 1);
multiplicities.SetValue(8, 1);
multiplicities.SetValue(9, 1);
Standard_Integer degree = 3; set degree equal to 3
Handle(Geom_BSplineCurve) bsplineCurve = new Geom_BSplineCurve(controlPoints, knots, multiplicities, degree, Standard_False);
return bsplineCurve;
}
main function here
int main()
{
Handle(Geom_BSplineCurve) bsplineCurve = CreateBSplineCurve();
std::cout << "Degree: " << bsplineCurve->Degree() << std::endl;
return 0;
}
what's wrong this code ? visual studio 2022 claim I have memory overflow