GCPnts_UniformAbscissa issue

I have a B-Spline 3d curve , built from an array of 3d points calling a function like this:
Handle(Geom_BSplineCurve) aBSplineCurve = aBSpline.Curve(); where aBSpline comes from GeomAPI_PointsToBSpline . This is ok.

Now I want get discrete 3d points on that curve, using "GCPnts_UniformAbscissa" class , example :
GCPnts_UniformAbscissa DiscretePoints( ACurve, 30.0);

Unfortunately , the constructor of GCPnts_UniformAbscissa accepts only "const Adaptor3d_Curve&"
Now my question is :

How convert a 'const opencascade::handle<Geom_Curve> (aBSplineCurve) to a 'const Adaptor3d_Curve' ?
Thanks in advance

Thomas Anderson's picture

Adaptor3d_Curve is a base class, so you should be able to do something like:
GeomAdaptor_Curve ca(aBSplineCurve);
GCPnts_UniformAbscissa DiscretePoints(ca, 30.0);

WenBo Zhang's picture

why this code is failed?

TopoDS_Edge aEdge; //edge of surface;
Standard_Real first, second;
Handle(Geom_Curve) c=BRep_Tool::Curve(aEdge,first,second);

GeomAdaptor_Curve adapC(c);

GCPnts_UniformAbscissa sUniPoints(adapC, 1.0);

sUniPoints.IsDone() //this code is false, the seperation points on edge is failed;

if you have any method,pls tell me.

Mikhail Sazonov's picture

Probably you must to create the restricted adaptor:

GeomAdaptor_Curve adapC(c, first, second);

Or, alternatively, restrict the range of the curve like this:

GCPnts_UniformAbscissa sUniPoints(adapC, 1.0, first, second);

Anyhow, you must restrict the considered range of the curve that by default may be infinite.