X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_BSplineOperation.cxx;h=97fd9a57ffc5e6cb860b4b2435d2a4ef9cf5cee1;hb=c52bda48bea5753316f128f52a3be1abb5aff055;hp=293dbd442b6c6032e802982bbf1b17e46f87ffca;hpb=aab4319f1f8306683e93dbd71ac7a02c0437fac6;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_BSplineOperation.cxx b/src/HYDROData/HYDROData_BSplineOperation.cxx index 293dbd44..97fd9a57 100644 --- a/src/HYDROData/HYDROData_BSplineOperation.cxx +++ b/src/HYDROData/HYDROData_BSplineOperation.cxx @@ -11,15 +11,30 @@ HYDROData_BSplineOperation::HYDROData_BSplineOperation( const NCollection_Sequence& thePoints, - const bool theIsClosed ) + const bool theIsClosed, + const double theTolerance ) { - // fill array for algorithm by the received coordinates + // skip equal points int aNbPoints = thePoints.Size(); + NCollection_Sequence aPoints; + if ( aNbPoints > 0 ) { + gp_XYZ aPrevPoint = thePoints.Value( 1 ); + aPoints.Append( aPrevPoint ); + for( int i = 2 ; i <= aNbPoints; ++i ) + { + gp_XYZ aPoint( thePoints.Value( i ) ); + if ( !aPoint.IsEqual( aPrevPoint, theTolerance ) ) + aPoints.Append( aPoint ); + aPrevPoint = aPoint; + } + } + // fill array for algorithm by the received coordinates + aNbPoints = aPoints.Size(); Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt( 1, aNbPoints ); for ( int i = 1; i <= aNbPoints; i++ ) { - gp_Pnt aPnt( thePoints.Value( i ) ); + gp_Pnt aPnt( aPoints.Value( i ) ); aHCurvePoints->SetValue( i, aPnt ); }