[partially solved]GeomAPI_Interpolate not very smooth result after zooming

Using a slightly adapted code found in the Geometry example, I'm trying to display a 3d spline using GeomAPI_Interpolate.

When i zoom into the view, the spline representation seems to be not very smooth.

Is there a parameter which allows to control the maximum [maybe chordal] error of the displayed discrete line set or is there another approach which reperforms the interpolation in an LOD sense?

 

I had a look at the tolerance parameter of GeomAPI_Interpolate but it's not what I'm looking for:

  //! The tolerance value Tolerance is used to check that:
  //! -   points are not too close to each other, or
  //! -   tangential vectors (defined using the
  //! function Load) are not too small.

 

Maybe StdPrs_Curve looks promising as it states

//! A framework to define display of lines, arcs of circles
//! and conic sections.
//! This is done with a fixed number of points, which can be modified.

but I couldn't find out how that would work and if it's what I'm looking for.

 

Could someone give me a pointer on how to approach that?

 

 

Lion G.'s picture

To answer my own question partially, one possible approach i found in a couple of samples seems to be to use the Attributes() member of SelectMgr_SelectableObject (which is the superclass of AIS_InteractiveObject) and use SetDiscretisation(...) to set a constant number of points for discretisation.

e.g.

splineShape->Attributes()->SetDiscretisation(1000);

Though, i couldn't find a way to discretize the spline using constraints like maximum angle or chordal error.

There exist the functions SetDeviationAngle and SetDeviationCoefficient in Prs3d_Drawer but it seems like StdPrs_Curve::Add, which the sample uses, internally calls DrawCurve which simply doesn't take these into account but equally distributes the points along the parametric representation in U:

const Standard_Integer N = Max(2, NbP*nbintervals);
const Standard_Real DU = (U2-U1) / (N-1);