From 41c52af3a762ca0309560fcff81d914d8e8dc2d9 Mon Sep 17 00:00:00 2001 From: szy Date: Sat, 10 Mar 2012 13:53:24 +0400 Subject: [PATCH] 0022488: Typo in Geom2d_BSplineCurve::LocateU() - which uses a value not adjusted to period for periodic B-Splines --- src/Geom/Geom_BSplineCurve_1.cxx | 13 +++++++------ src/Geom/Geom_BSplineSurface_1.cxx | 26 ++++++++++++++------------ src/Geom2d/Geom2d_BSplineCurve_1.cxx | 13 +++++++------ 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/Geom/Geom_BSplineCurve_1.cxx b/src/Geom/Geom_BSplineCurve_1.cxx index 6e95531cef..18617c3cd1 100755 --- a/src/Geom/Geom_BSplineCurve_1.cxx +++ b/src/Geom/Geom_BSplineCurve_1.cxx @@ -709,23 +709,24 @@ void Geom_BSplineCurve::LocateU Standard_Real UFirst = CKnots (1); Standard_Real ULast = CKnots (CKnots.Length()); - if (Abs (NewU - UFirst) <= Abs(ParametricTolerance)) { I1 = I2 = 1; } - else if (Abs (NewU - ULast) <= Abs(ParametricTolerance)) { + Standard_Real PParametricTolerance = Abs(ParametricTolerance); + if (Abs (NewU - UFirst) <= PParametricTolerance) { I1 = I2 = 1; } + else if (Abs (NewU - ULast) <= PParametricTolerance) { I1 = I2 = CKnots.Length(); } - else if (NewU < UFirst - Abs(ParametricTolerance)) { + else if (NewU < UFirst) { I2 = 1; I1 = 0; } - else if (NewU > ULast + Abs(ParametricTolerance)) { + else if (NewU > ULast) { I1 = CKnots.Length(); I2 = I1 + 1; } else { I1 = 1; BSplCLib::Hunt (CKnots, NewU, I1); - while ( Abs( CKnots(I1+1) - NewU) <= Abs(ParametricTolerance)) I1++; - if ( Abs( CKnots(I1) - NewU) <= Abs(ParametricTolerance)) { + while ( Abs( CKnots(I1+1) - NewU) <= PParametricTolerance) I1++; + if ( Abs( CKnots(I1) - NewU) <= PParametricTolerance) { I2 = I1; } else { diff --git a/src/Geom/Geom_BSplineSurface_1.cxx b/src/Geom/Geom_BSplineSurface_1.cxx index f6377faf63..a4704b9054 100755 --- a/src/Geom/Geom_BSplineSurface_1.cxx +++ b/src/Geom/Geom_BSplineSurface_1.cxx @@ -1443,25 +1443,26 @@ void Geom_BSplineSurface::LocateU const TColStd_Array1OfReal & Knots = TheKnots->Array1(); Standard_Real UFirst = Knots (1); Standard_Real ULast = Knots (Knots.Length()); - if (Abs (NewU - UFirst) <= Abs(ParametricTolerance)) { + Standard_Real PParametricTolerance = Abs(ParametricTolerance); + if (Abs (NewU - UFirst) <= PParametricTolerance) { I1 = I2 = 1; } - else if (Abs (NewU - ULast) <= Abs(ParametricTolerance)) { + else if (Abs (NewU - ULast) <= PParametricTolerance) { I1 = I2 = Knots.Length(); } - else if (NewU < UFirst - Abs(ParametricTolerance)) { + else if (NewU < UFirst) { I2 = 1; I1 = 0; } - else if (NewU > ULast + Abs(ParametricTolerance)) { + else if (NewU > ULast) { I1 = Knots.Length(); I2 = I1 + 1; } else { I1 = 1; BSplCLib::Hunt (Knots, NewU, I1); - while ( Abs( Knots(I1+1) - NewU) <= Abs(ParametricTolerance)) I1++; - if ( Abs( Knots(I1) - NewU) <= Abs(ParametricTolerance)) { + while ( Abs( Knots(I1+1) - NewU) <= PParametricTolerance) I1++; + if ( Abs( Knots(I1) - NewU) <= PParametricTolerance) { I2 = I1; } else { @@ -1492,23 +1493,24 @@ void Geom_BSplineSurface::LocateV const TColStd_Array1OfReal & Knots = TheKnots->Array1(); Standard_Real VFirst = Knots (1); Standard_Real VLast = Knots (Knots.Length()); - if (Abs (NewV - VFirst) <= Abs(ParametricTolerance)) { I1 = I2 = 1; } - else if (Abs (NewV - VLast) <= Abs(ParametricTolerance)) { + Standard_Real PParametricTolerance = Abs(ParametricTolerance); + if (Abs (NewV - VFirst) <= PParametricTolerance) { I1 = I2 = 1; } + else if (Abs (NewV - VLast) <= PParametricTolerance) { I1 = I2 = Knots.Length(); } - else if (NewV < VFirst - Abs(ParametricTolerance)) { + else if (NewV < VFirst - PParametricTolerance) { I2 = 1; I1 = 0; } - else if (NewV > VLast + Abs(ParametricTolerance)) { + else if (NewV > VLast + PParametricTolerance) { I1 = Knots.Length(); I2 = I1 + 1; } else { I1 = 1; BSplCLib::Hunt (Knots, NewV, I1); - while ( Abs( Knots(I1+1) - NewV) <= Abs(ParametricTolerance)) I1++; - if ( Abs( Knots(I1) - NewV) <= Abs(ParametricTolerance)) { + while ( Abs( Knots(I1+1) - NewV) <= PParametricTolerance) I1++; + if ( Abs( Knots(I1) - NewV) <= PParametricTolerance) { I2 = I1; } else { diff --git a/src/Geom2d/Geom2d_BSplineCurve_1.cxx b/src/Geom2d/Geom2d_BSplineCurve_1.cxx index 7f86b02f0e..3685fe5cdc 100755 --- a/src/Geom2d/Geom2d_BSplineCurve_1.cxx +++ b/src/Geom2d/Geom2d_BSplineCurve_1.cxx @@ -711,23 +711,24 @@ void Geom2d_BSplineCurve::LocateU PeriodicNormalization(NewU); //Attention a la periode Standard_Real UFirst = CKnots (1); Standard_Real ULast = CKnots (CKnots.Length()); - if (Abs (NewU - UFirst) <= Abs(ParametricTolerance)) { I1 = I2 = 1; } - else if (Abs (U - ULast) <= Abs(ParametricTolerance)) { + Standard_Real PParametricTolerance = Abs(ParametricTolerance); + if (Abs (NewU - UFirst) <= PParametricTolerance) { I1 = I2 = 1; } + else if (Abs (NewU - ULast) <= PParametricTolerance) { I1 = I2 = CKnots.Length(); } - else if (NewU < UFirst - Abs(ParametricTolerance)) { + else if (NewU < UFirst) { I2 = 1; I1 = 0; } - else if (NewU > ULast + Abs(ParametricTolerance)) { + else if (NewU > ULast) { I1 = CKnots.Length(); I2 = I1 + 1; } else { I1 = 1; BSplCLib::Hunt (CKnots, NewU, I1); - while ( Abs( CKnots(I1+1) - NewU) <= Abs(ParametricTolerance)) I1++; - if ( Abs( CKnots(I1) - NewU) <= Abs(ParametricTolerance)) { + while ( Abs( CKnots(I1+1) - NewU) <= PParametricTolerance) I1++; + if ( Abs( CKnots(I1) - NewU) <= PParametricTolerance) { I2 = I1; } else {