mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0031402: Modeling Data - Geom_BSplineSurface::Segment() produces wrong result
In the method Segment() index1 needs to be checked as well as index2 in Geom_BSplineSurface and Geom2d_BSplineCurve (Geom_BSplineCurve already has this check). New test cases bug31402_1, bug31402_2 has been added. The unnecessary code block in Geom2d_BSplineCurve has been deleted, and checking index2 block has beed extended.
This commit is contained in:
@@ -660,27 +660,8 @@ void Geom2d_BSplineCurve::Segment(const Standard_Real aU1,
|
||||
Standard_Integer i, k, index;
|
||||
//
|
||||
//f
|
||||
// Checking the input bounds aUj (j=1,2).
|
||||
// For the case when aUj==knot(i),
|
||||
// in order to prevent the insertion of a new knot that will be too closed
|
||||
// to the existing knot,
|
||||
// we assign Uj=knot(i)
|
||||
Standard_Integer n1, n2;
|
||||
Standard_Real U1, U2;
|
||||
Standard_Real U1 = aU1, U2 = aU2;
|
||||
//
|
||||
U1=aU1;
|
||||
U2=aU2;
|
||||
n1=knots->Lower();
|
||||
n2=knots->Upper();
|
||||
for (i=n1; i<=n2; ++i) {
|
||||
U=knots->Value(i);
|
||||
if (Abs(U-aU1)<=Eps) {
|
||||
U1=U;
|
||||
}
|
||||
else if (Abs(U-aU2)<=Eps) {
|
||||
U2=U;
|
||||
}
|
||||
}
|
||||
// Henceforward we use U1, U2 as bounds of the segment
|
||||
//t
|
||||
//
|
||||
@@ -730,10 +711,13 @@ void Geom2d_BSplineCurve::Segment(const Standard_Real aU1,
|
||||
Standard_Integer ToU2 = knots->Upper();
|
||||
BSplCLib::LocateParameter(deg,knots->Array1(),mults->Array1(),
|
||||
NewU1,periodic,FromU1,ToU2,index1,U);
|
||||
if (Abs(knots->Value(index1 + 1) - U) <= Eps){
|
||||
index1++;
|
||||
}
|
||||
BSplCLib::LocateParameter(deg,knots->Array1(),mults->Array1(),
|
||||
NewU2,periodic,FromU1,ToU2,index2,U);
|
||||
// Eps = Epsilon(knots->Value(index2+1));
|
||||
if ( Abs(knots->Value(index2+1)-U) <= Eps){
|
||||
if ( Abs(knots->Value(index2+1)-U) <= Eps || index2 == index1){
|
||||
index2++;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user