HYDROData_BSplineOperation::HYDROData_BSplineOperation(
const NCollection_Sequence<gp_XYZ>& 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<gp_XYZ> 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 );
}