return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
"for an edge of length "<<theLength);
- double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
- int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));
+ // double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
+ // int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));
+ int n = int(2 * theLength / ( a1 + an ) + 0.5);
+ double q = (n > 1 ? ( an - a1 ) / (n - 1) : 0.0);
+
+ std::cout << "a1 = " << a1 << ", an = " << an << ", len = " << theLength << std::endl;
+ std::cout << "n = " << n << ", q = " << q << std::endl;
double U1 = theReverse ? l : f;
double Un = theReverse ? f : l;