diff --git a/src/IntWalk/IntWalk_IWalking_2.gxx b/src/IntWalk/IntWalk_IWalking_2.gxx index a35a87531b..2e5d7f0cdd 100644 --- a/src/IntWalk/IntWalk_IWalking_2.gxx +++ b/src/IntWalk/IntWalk_IWalking_2.gxx @@ -22,6 +22,14 @@ #define No_Standard_OutOfRange #endif +static void CutVectorByTolerances (gp_Vec2d& theVector, + const math_Vector& theTolerance) +{ + if (Abs(theVector.X()) < theTolerance(1)) + theVector.SetX (0.); + if (Abs(theVector.Y()) < theTolerance(2)) + theVector.SetY (0.); +} // _______________________________________________ // @@ -771,8 +779,13 @@ void IntWalk_IWalking::TestArretCadre Line->Value(j).ParametersOnS1(Uc,Vc); } - Scal = (Up-wd1[i].ustart) * (Uc-wd1[i].ustart) + - (Vp-wd1[i].vstart) * (Vc-wd1[i].vstart); + gp_Vec2d aVec1 (Up-wd1[i].ustart, Vp-wd1[i].vstart), + aVec2 (Uc-wd1[i].ustart, Vc-wd1[i].vstart); + CutVectorByTolerances (aVec1, tolerance); + CutVectorByTolerances (aVec2, tolerance); + + Scal = aVec1 * aVec2; + // if a stop point is found: stop the line on this point. if (Scal < 0) { Line->Cut(j); nbp= Line->NbPoints(); @@ -791,8 +804,14 @@ void IntWalk_IWalking::TestArretCadre } else if (nbMultiplicities[i] > 0) { for (Standard_Integer k = N+1; k <= N + nbMultiplicities[i]; k++) { - Scal = (Up-Umult(k)) * (Uc-Umult(k)) + - (Vp-Vmult(k)) * (Vc-Vmult(k)); + + aVec1.SetCoord (Up-Umult(k), Vp-Vmult(k)), + aVec2.SetCoord (Uc-Umult(k), Vc-Vmult(k)); + CutVectorByTolerances (aVec1, tolerance); + CutVectorByTolerances (aVec2, tolerance); + + Scal = aVec1 * aVec2; + if (Scal < 0) { Line->Cut(j); nbp= Line->NbPoints(); Irang=i; @@ -847,11 +866,13 @@ void IntWalk_IWalking::TestArretCadre // now the last point of the line and the last calculated point are compated. // there will be no need to "Cut" - Scal = (Up-wd1[i].ustart) * (UV(1)-wd1[i].ustart) + - // (Vp-wd1[i].vstart) * (UV(2)-wd1[i].vstart); - // modified by NIZHNY-MKK Fri Oct 27 12:29:41 2000 - (Vp-wd1[i].vstart) * (UV(2)-wd1[i].vstart); - + gp_Vec2d aVec1 (Up-wd1[i].ustart, Vp-wd1[i].vstart), + aVec2 (UV(1)-wd1[i].ustart, UV(2)-wd1[i].vstart); + CutVectorByTolerances (aVec1, tolerance); + CutVectorByTolerances (aVec2, tolerance); + + Scal = aVec1 * aVec2; + if (Scal < 0) { Irang = i; UV(1) = wd1[Irang].ustart; @@ -867,8 +888,14 @@ void IntWalk_IWalking::TestArretCadre } else if (nbMultiplicities[i] > 0) { for (Standard_Integer j = N+1; j <= N+nbMultiplicities[i]; j++) { - Scal = (Up-Umult(j)) * (UV(1)-Umult(j)) + - (Vp-Vmult(j)) * (UV(2)-Vmult(j)); + + aVec1.SetCoord (Up-Umult(j), Vp-Vmult(j)); + aVec2.SetCoord (UV(1)-Umult(j), UV(2)-Vmult(j)); + CutVectorByTolerances (aVec1, tolerance); + CutVectorByTolerances (aVec2, tolerance); + + Scal = aVec1 * aVec2; + if (Scal < 0) { Irang=i; UV(1) = wd1[Irang].ustart; diff --git a/tests/hlr/exact_hlr/C13 b/tests/hlr/exact_hlr/C13 index 6f702cdfd2..255ff26e64 100644 --- a/tests/hlr/exact_hlr/C13 +++ b/tests/hlr/exact_hlr/C13 @@ -1,5 +1,3 @@ -puts "TODO OCC30286 ALL: Error : The length of result shape is 9589.21, expected 9547.11" - set viewname "vright" set length 9547.11 diff --git a/tests/hlr/exact_hlr/C18 b/tests/hlr/exact_hlr/C18 index 1b73d4c3a4..ca7c58f7af 100644 --- a/tests/hlr/exact_hlr/C18 +++ b/tests/hlr/exact_hlr/C18 @@ -1,6 +1,3 @@ -puts "TODO OCC30286 Windows: Error : The length of result shape is 2416.66, expected 2418.08" -puts "TODO OCC30286 Linux: Error : The length of result shape is 2414.48, expected 2418.08" - set viewname "vright" set length 2418.08 diff --git a/tests/hlr/exact_hlr/C3 b/tests/hlr/exact_hlr/C3 index 5211d9ca17..8046b6722c 100644 --- a/tests/hlr/exact_hlr/C3 +++ b/tests/hlr/exact_hlr/C3 @@ -1,7 +1,5 @@ -puts "TODO OCC30286 Linux: Error : The length of result shape is 3249.9, expected 3234.6" - set viewname "vright" -set length 3234.6 +set length 3237.63 testreadstep [locate_data_file bug27341_570-DWLNL-40-08-L_131LANG_16VERSATZ_DIN.stp] a COMPUTE_HLR $viewname $algotype diff --git a/tests/hlr/exact_hlr/bug32747 b/tests/hlr/exact_hlr/bug32747 new file mode 100644 index 0000000000..ae97d80d13 --- /dev/null +++ b/tests/hlr/exact_hlr/bug32747 @@ -0,0 +1,10 @@ +puts "================================================" +puts "OCC32747: Exact HLR algorithm gives wrong result" +puts "================================================" +puts "" + +set viewname "vfront" +set length 34.3597 + +restore [locate_data_file bug32747.brep] a +COMPUTE_HLR $viewname $algotype diff --git a/tests/hlr/exact_hlr/end b/tests/hlr/exact_hlr/end new file mode 100644 index 0000000000..0928d556f2 --- /dev/null +++ b/tests/hlr/exact_hlr/end @@ -0,0 +1,6 @@ +checkprops result -l ${length} + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png + +# to end a test script +puts "TEST COMPLETED" diff --git a/tests/hlr/end b/tests/hlr/poly_hlr/end similarity index 100% rename from tests/hlr/end rename to tests/hlr/poly_hlr/end