How to obtain points on a Geom_BSplineCurve

Hi,

How can I obtain some points on a Geom_BSplineCurve ?

Thanks for your response.

Kreshnik's picture

I found this :

// Obtention des deux extremités
Standard_Real First,Last;
Handle(Geom_Curve) myCurve = BRep_Tool::Curve(myEdge, First, Last);
Handle(Geom_TrimmedCurve) myTrimmed = new Geom_TrimmedCurve(myCurve, First, Last);
gp_Pnt pt_start = myTrimmed->StartPoint();
gp_Pnt pt_end = myTrimmed->EndPoint();

// Conversion en BSplineCurve
Handle(Geom_BSplineCurve) myBSplCurve = GeomConvert::CurveToBSplineCurve(myTrimmed);

// Récuperation de deux pôles
Standard_Integer nb_poles = myBSplCurve->NbPoles();
gp_Pnt pt_pole1 = myBSplCurve->Pole(2);
gp_Pnt pt_pole2 = myBSplCurve->Pole(nb_poles-1);

// On projette les pôles sur la courbe
GeomAPI_ProjectPointOnCurve proj1;
GeomAPI_ProjectPointOnCurve proj2;
proj1.Init(pt_pole1, myCurve, First, Last);
proj2.Init(pt_pole2, myCurve, First, Last);

// On recupere les points de projection
gp_Pnt pt_curve1 = proj1.NearestPoint();
gp_Pnt pt_curve2 = proj2.NearestPoint();