+ compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
+ if (theReverse) theParams.reverse(); // NPAL18025
+
+ return true;
+ }
+
+ case GEOMETRIC_1D: {
+
+ double a1 = _value[ BEG_LENGTH_IND ], an;
+ double q = _value[ END_LENGTH_IND ];
+
+ double U1 = theReverse ? l : f;
+ double Un = theReverse ? f : l;
+ double param = U1;
+ double eltSize = a1;
+ if ( theReverse )
+ eltSize = -eltSize;
+
+ int nbParams = 0;
+ while ( true ) {
+ // computes a point on a curve <theC3d> at the distance <eltSize>
+ // from the point of parameter <param>.
+ GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
+ if ( !Discret.IsDone() ) break;
+ param = Discret.Parameter();
+ if ( f < param && param < l )
+ theParams.push_back( param );
+ else
+ break;
+ an = eltSize;
+ eltSize *= q;
+ ++nbParams;
+ }
+ if ( nbParams > 1 )
+ {
+ if ( Abs( param - Un ) < 0.2 * Abs( param - theParams.back() ))
+ {
+ compensateError( a1, eltSize, U1, Un, theLength, theC3d, theParams );
+ }
+ else if ( Abs( Un - theParams.back() ) <
+ 0.2 * Abs( theParams.back() - *(--theParams.rbegin())))
+ {
+ theParams.pop_back();
+ compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
+ }
+ }
+ if (theReverse) theParams.reverse(); // NPAL18025
+
+ return true;
+ }
+
+ case FIXED_POINTS_1D: {
+ const std::vector<double>& aPnts = _fpHyp->GetPoints();
+ const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
+ int i = 0;
+ TColStd_SequenceOfReal Params;
+ for(; i<aPnts.size(); i++) {
+ if( aPnts[i]<0.0001 || aPnts[i]>0.9999 ) continue;
+ int j=1;
+ bool IsExist = false;
+ for(; j<=Params.Length(); j++) {
+ if( fabs(aPnts[i]-Params.Value(j)) < 1e-4 ) {
+ IsExist = true;
+ break;
+ }
+ if( aPnts[i]<Params.Value(j) ) break;
+ }
+ if(!IsExist) Params.InsertBefore(j,aPnts[i]);
+ }
+ double par2, par1, lp;
+ par1 = f;
+ lp = l;
+ double sign = 1.0;
+ if(theReverse) {
+ par1 = l;
+ lp = f;
+ sign = -1.0;
+ }
+ double eltSize, segmentSize = 0.;
+ double currAbscissa = 0;
+ for(i=0; i<Params.Length(); i++) {
+ int nbseg = ( i > nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
+ segmentSize = Params.Value(i+1)*theLength - currAbscissa;
+ currAbscissa += segmentSize;
+ GCPnts_AbscissaPoint APnt(theC3d, sign*segmentSize, par1);
+ if( !APnt.IsDone() )
+ return error( "GCPnts_AbscissaPoint failed");
+ par2 = APnt.Parameter();
+ eltSize = segmentSize/nbseg;
+ GCPnts_UniformAbscissa Discret(theC3d, eltSize, par1, par2);
+ if(theReverse)
+ Discret.Initialize(theC3d, eltSize, par2, par1);
+ else
+ Discret.Initialize(theC3d, eltSize, par1, par2);
+ if ( !Discret.IsDone() )
+ return error( "GCPnts_UniformAbscissa failed");
+ int NbPoints = Discret.NbPoints();
+ list<double> tmpParams;
+ for(int i=2; i<NbPoints; i++) {
+ double param = Discret.Parameter(i);
+ tmpParams.push_back( param );
+ }
+ if (theReverse) {
+ compensateError( eltSize, eltSize, par2, par1, segmentSize, theC3d, tmpParams );
+ tmpParams.reverse();
+ }
+ else {
+ compensateError( eltSize, eltSize, par1, par2, segmentSize, theC3d, tmpParams );
+ }
+ list<double>::iterator itP = tmpParams.begin();
+ for(; itP != tmpParams.end(); itP++) {
+ theParams.push_back( *(itP) );
+ }
+ theParams.push_back( par2 );
+
+ par1 = par2;
+ }
+ // add for last
+ int nbseg = ( nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
+ segmentSize = theLength - currAbscissa;
+ eltSize = segmentSize/nbseg;
+ GCPnts_UniformAbscissa Discret;
+ if(theReverse)
+ Discret.Initialize(theC3d, eltSize, par1, lp);
+ else
+ Discret.Initialize(theC3d, eltSize, lp, par1);
+ if ( !Discret.IsDone() )
+ return error( "GCPnts_UniformAbscissa failed");
+ int NbPoints = Discret.NbPoints();
+ list<double> tmpParams;
+ for(int i=2; i<NbPoints; i++) {
+ double param = Discret.Parameter(i);
+ tmpParams.push_back( param );
+ }
+ if (theReverse) {
+ compensateError( eltSize, eltSize, lp, par1, segmentSize, theC3d, tmpParams );
+ tmpParams.reverse();
+ }
+ else {
+ compensateError( eltSize, eltSize, par1, lp, segmentSize, theC3d, tmpParams );
+ }
+ list<double>::iterator itP = tmpParams.begin();
+ for(; itP != tmpParams.end(); itP++) {
+ theParams.push_back( *(itP) );
+ }