From aeaf53d5ed8440f89e111f938d7953f10daba73d Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 27 Sep 2013 10:32:19 +0400 Subject: [PATCH] 0024134: Wrong result of projection point on the face Changed Bnd_SphereUBTreeSelector for the Extrema_ExtAlgo_Tree projection algorithm properly work Test case for issue CR24134 --- src/Extrema/Extrema_GenExtPS.cxx | 6 ++++-- tests/bugs/moddata_3/bug24134 | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/moddata_3/bug24134 diff --git a/src/Extrema/Extrema_GenExtPS.cxx b/src/Extrema/Extrema_GenExtPS.cxx index 37181864d3..3aea395d9c 100755 --- a/src/Extrema/Extrema_GenExtPS.cxx +++ b/src/Extrema/Extrema_GenExtPS.cxx @@ -114,7 +114,8 @@ Standard_Boolean Bnd_SphereUBTreeSelectorMin::Accept(const Standard_Integer& the const Bnd_Sphere& aSph = mySphereArray->Value(theInd); Standard_Real aCurDist; - if ( (aCurDist = aSph.SquareDistance(myXYZ.XYZ())) < mySol.SquareDistance(myXYZ.XYZ()) ) +// if ( (aCurDist = aSph.SquareDistance(myXYZ.XYZ())) < mySol.SquareDistance(myXYZ.XYZ()) ) + if ( (aCurDist = aSph.Distance(myXYZ.XYZ())) < mySol.Distance(myXYZ.XYZ()) ) { mySol = aSph; if ( aCurDist < myMinDist ) @@ -160,7 +161,8 @@ Standard_Boolean Bnd_SphereUBTreeSelectorMax::Accept(const Standard_Integer& the const Bnd_Sphere& aSph = mySphereArray->Value(theInd); Standard_Real aCurDist; - if ( (aCurDist = aSph.SquareDistance(myXYZ.XYZ())) > mySol.SquareDistance(myXYZ.XYZ()) ) +// if ( (aCurDist = aSph.SquareDistance(myXYZ.XYZ())) > mySol.SquareDistance(myXYZ.XYZ()) ) + if ( (aCurDist = aSph.Distance(myXYZ.XYZ())) > mySol.Distance(myXYZ.XYZ()) ) { mySol = aSph; if ( aCurDist > myMaxDist ) diff --git a/tests/bugs/moddata_3/bug24134 b/tests/bugs/moddata_3/bug24134 new file mode 100644 index 0000000000..3b4eb75887 --- /dev/null +++ b/tests/bugs/moddata_3/bug24134 @@ -0,0 +1,34 @@ +puts "========" +puts "CR24134" +puts "========" +puts "" +####################################################################### +# Wrong result of projection point on the face +####################################################################### + +restore [locate_data_file bug22109_tore.brep] b +explode b f + +copy b_1 f +point p 934.419505115097 1387.10553740067 8.42056376938594e-014 + +set GOOD_DIST 1.0481408664017105e-12 +set CMP_TOL 5.0e-12 + +# 1 +set log_t [projponf f p -t] +regexp {proj dist = ([-0-9.+eE]+)} ${log_t} full distmax_t +if { [expr abs(${distmax_t} - ${GOOD_DIST})] > ${CMP_TOL} } { + puts "Error: Wrong intersection point (t-option)" +} else { + puts "OK: Good intersection point (t-option)" +} + +# 2 +set log_g [projponf f p -g] +regexp {proj dist = ([-0-9.+eE]+)} ${log_g} full distmax_g +if { [expr abs(${distmax_g} - ${GOOD_DIST})] > ${CMP_TOL} } { + puts "Error: Wrong intersection point (g-option)" +} else { + puts "OK: Good intersection point (g-option)" +}