1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0024137: math_FunctionSetRoot returns too rough solution

Test case and new draw command for issue CR24137
Modified test case de/iges_1/G9 according to new data
Small correction of test cases for issue CR24137
This commit is contained in:
ifv 2013-10-03 14:34:03 +04:00 committed by bugmaster
parent 91bb31f35e
commit 89d8607f13
6 changed files with 629 additions and 542 deletions

View File

@ -1234,6 +1234,69 @@ static Standard_Integer OCC24005 (Draw_Interpretor& theDI, Standard_Integer theN
return 0;
}
#include <Extrema_FuncExtPS.hxx>
#include <math_FunctionSetRoot.hxx>
#include <math_Vector.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
static Standard_Integer OCC24137 (Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv)
{
Standard_Integer anArgIter = 1;
if (theNArg < 5)
{
theDI <<"Usage: " << theArgv[0] << " face vertex U V [N]"<<"\n";
return 1;
}
// get target shape
Standard_CString aFaceName = theArgv[anArgIter++];
Standard_CString aVertName = theArgv[anArgIter++];
const TopoDS_Shape aShapeF = DBRep::Get (aFaceName);
const TopoDS_Shape aShapeV = DBRep::Get (aVertName);
const Standard_Real aUFrom = Atof (theArgv[anArgIter++]);
const Standard_Real aVFrom = Atof (theArgv[anArgIter++]);
const Standard_Integer aNbIts = (anArgIter < theNArg) ? atol (theArgv[anArgIter++]) : 100;
if (aShapeF.IsNull() || aShapeF.ShapeType() != TopAbs_FACE)
{
std::cout << "Error: " << aFaceName << " shape is null / not a face" << std::endl;
return 1;
}
if (aShapeV.IsNull() || aShapeV.ShapeType() != TopAbs_VERTEX)
{
std::cout << "Error: " << aVertName << " shape is null / not a vertex" << std::endl;
return 1;
}
const TopoDS_Face aFace = TopoDS::Face (aShapeF);
const TopoDS_Vertex aVert = TopoDS::Vertex (aShapeV);
GeomAdaptor_Surface aSurf (BRep_Tool::Surface (aFace));
gp_Pnt aPnt = BRep_Tool::Pnt (aVert), aRes;
Extrema_FuncExtPS anExtFunc;
math_FunctionSetRoot aRoot (anExtFunc, aNbIts);
math_Vector aTolUV (1, 2), aUVinf (1, 2), aUVsup (1, 2), aFromUV (1, 2);
aTolUV (1) = Precision::Confusion(); aTolUV (2) = Precision::Confusion();
aUVinf (1) = -Precision::Infinite(); aUVinf (2) = -Precision::Infinite();
aUVsup (1) = Precision::Infinite(); aUVsup (2) = Precision::Infinite();
aFromUV(1) = aUFrom; aFromUV(2) = aVFrom;
anExtFunc.Initialize (aSurf);
anExtFunc.SetPoint (aPnt);
aRoot.SetTolerance (aTolUV);
aRoot.Perform (anExtFunc, aFromUV, aUVinf, aUVsup);
if (!aRoot.IsDone())
{
std::cerr << "No results!\n";
return 1;
}
theDI << aRoot.Root()(1) << " " << aRoot.Root()(2) << "\n";
aSurf.D0 (aRoot.Root()(1), aRoot.Root()(2), aRes);
DBRep::Set ("result", BRepBuilderAPI_MakeVertex (aRes));
return 0;
}
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
@ -1254,5 +1317,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
theCommands.Add ("OCC24019", "OCC24019 aShape", __FILE__, OCC24019, group);
theCommands.Add ("OCC11758", "OCC11758", __FILE__, OCC11758, group);
theCommands.Add ("OCC24005", "OCC24005 result", __FILE__, OCC24005, group);
theCommands.Add ("OCC24137", "OCC24137 face vertex U V [N]", __FILE__, OCC24137, group);
return;
}

File diff suppressed because it is too large Load Diff

22
tests/bugs/fclasses/bug24137 Executable file
View File

@ -0,0 +1,22 @@
puts "================"
puts "OCC24137"
puts "================"
puts ""
#######################################################################
# math_FunctionSetRoot returns too rough solution
#######################################################################
pload QAcommands
vertex v 6.65634 -0.201746 2.51477
restore [locate_data_file bug24137_face.brep] f
OCC24137 f v 508.326 77.6999
distmini d v result
regexp {([-0-9.+eE]+)$} [dump d_val] full dist
set good_dist 0
set toler 2.0e-06
if { [expr abs( ${dist} - ${good_dist} )] > ${toler} } {
puts "Faulty : the distanse is ${dist}. It is bad value"
}

View File

@ -39,7 +39,8 @@ puts "CPU_user_time=${CPU_user_time}"
set CPU_user_time [expr ${CPU_user_time} / ${NbTests}]
puts "CPU_user_time=${CPU_user_time}"
set square 3.56087e+07
#CR24137 set square 3.56087e+07
set square 3.52471e+07
# Analysis of "nbshapes res"
set nb_v_good 24
@ -53,4 +54,3 @@ set nb_compound_good 1
set nb_shape_good 102
set 2dviewer 0

View File

@ -39,7 +39,8 @@ puts "CPU_user_time=${CPU_user_time}"
set CPU_user_time [expr ${CPU_user_time} / ${NbTests}]
puts "CPU_user_time=${CPU_user_time}"
set square 782201
#CR24317 set square 782201
set square 766474
# Analysis of "nbshapes res"
set nb_v_good 53

View File

@ -6,11 +6,11 @@ set filename lh93wsddr3370z4.igs
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
TPSTAT : Faulties = 0 ( 0 ) Warnings = 162 ( 4127 ) Summary = 162 ( 4127 )
TPSTAT : Faulties = 0 ( 0 ) Warnings = 164 ( 4127 ) Summary = 164 ( 4127 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 448 ( 448 ) Summary = 7237 ( 7237 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 448 ( 448 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 3192 ( 3192 )
TOLERANCE : MaxTol = 0.08683083502 ( 0.04341528762 ) AvgTol = 0.000870172875 ( 0.0007502917279 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 448 ( 448 ) Summary = 7239 ( 7237 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 448 ( 448 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 3193 ( 3192 )
TOLERANCE : MaxTol = 0.08683083502 ( 0.04341528762 ) AvgTol = 0.0008697846249 ( 0.0007558849075 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 1 ( 1 ) NameLabels = 1 ( 1 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 0 ( 0 )