+static bool computeParamByFunc(Adaptor3d_Curve& C3d, double first, double last,
+ double length, bool theReverse,
+ int nbSeg, Function& func,
+ list<double>& theParams)
+{
+ // never do this way
+ //OSD::SetSignal( true );
+
+ if (nbSeg <= 0)
+ return false;
+
+ MESSAGE( "computeParamByFunc" );
+
+ int nbPnt = 1 + nbSeg;
+ vector<double> x(nbPnt, 0.);
+
+ if (!buildDistribution(func, 0.0, 1.0, nbSeg, x, 1E-4))
+ return false;
+
+ MESSAGE( "Points:\n" );
+ char buf[1024];
+ for ( int i=0; i<=nbSeg; i++ )
+ {
+ sprintf( buf, "%f\n", float(x[i] ) );
+ MESSAGE( buf );
+ }
+
+
+
+ // apply parameters in range [0,1] to the space of the curve
+ double prevU = first;
+ double sign = 1.;
+ if (theReverse)
+ {
+ prevU = last;
+ sign = -1.;
+ }
+ for( int i = 1; i < nbSeg; i++ )
+ {
+ double curvLength = length * (x[i] - x[i-1]) * sign;
+ GCPnts_AbscissaPoint Discret( C3d, curvLength, prevU );
+ if ( !Discret.IsDone() )
+ return false;
+ double U = Discret.Parameter();
+ if ( U > first && U < last )
+ theParams.push_back( U );
+ else
+ return false;
+ prevU = U;
+ }
+ return true;
+}
+
+
+//================================================================================
+/*!
+ * \brief adjust internal node parameters so that the last segment length == an
+ * \param a1 - the first segment length
+ * \param an - the last segment length
+ * \param U1 - the first edge parameter
+ * \param Un - the last edge parameter
+ * \param length - the edge length
+ * \param C3d - the edge curve
+ * \param theParams - internal node parameters to adjust
+ * \param adjustNeighbors2an - to adjust length of segments next to the last one
+ * and not to remove parameters
+ */
+//================================================================================