BezierCurve constructor

How to use BezierCurve as a class memeber?

class ParamCurve {
public:

    ParamCurve(const gp_Pnt2d P1 = gp_Pnt2d(0, 0), const gp_Pnt2d P2 = gp_Pnt2d(1, 0)) {
        TColgp_Array1OfPnt2d CurvePoles(1, 2);
        CurvePoles(1) = P1;
        CurvePoles(2) = P2;
        myCurve = Geom2d_BezierCurve(CurvePoles);

    };
    virtual ~ParamCurve();

private:
    Geom2d_BezierCurve myCurve;

};

Give me following error:

ParamCurve.h: In constructor ‘ParamCurve::ParamCurve(gp_Pnt2d, gp_Pnt2d)’:
ParamCurve.h:26:88: error: no matching function for call to ‘Geom2d_BezierCurve::Geom2d_BezierCurve()’

How to initialize myCurve ?

Benjamin Bihler's picture

Geom2d_BezierCurve doesn't have an empty constructor which would create an uninitialized curve. In this case one normally does one of the following:

- Make your poles creation a static method and initialize your curve in the constructor's initializer list and pass the return value of the static method as curve constructor parameter.

or

- Store your curve as pointer or handle. Both can be uninitialized. Then inside the constructor set them to the newly created curve.