From 12945d772038f3db3c041840d5ad412879df6515 Mon Sep 17 00:00:00 2001 From: jgv Date: Thu, 14 May 2015 17:03:42 +0300 Subject: [PATCH] 0026202: Wrong result of chamfer on cylindrical surface: wrong value of chord Test case for issue CR26202 --- .../ChFiKPart_ComputeData_ChPlnCyl.cxx | 14 +++---- tests/bugs/modalg_6/bug26202 | 40 +++++++++++++++++++ 2 files changed, 45 insertions(+), 9 deletions(-) create mode 100755 tests/bugs/modalg_6/bug26202 diff --git a/src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCyl.cxx b/src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCyl.cxx index 5bc1d3965e..700e2c8343 100644 --- a/src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCyl.cxx +++ b/src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCyl.cxx @@ -353,15 +353,11 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr, gp_Ax3 AxCyl = Cyl.Position(); // OrCyl is the point on axis of cylinder in the plane normal to the // axis containing OrSpine - gp_Pnt Loc = AxCyl.Location(); - gp_Vec LocSp(Loc, OrSpine); - gp_XYZ temp = AxCyl.Direction().XYZ(); - temp = temp.Multiplied(LocSp.XYZ().Multiplied(temp) ); - OrCyl.SetXYZ( (Loc.XYZ()).Added(temp) ); -// gp_XYZ temp = AxCyl.Direction().XYZ(); -// temp = temp.Multiplied( OrSpine.XYZ().Multiplied(temp) ); -// OrCyl.SetXYZ( (AxCyl.Location().XYZ()).Added(temp) ); - + // Project onto + gp_XYZ AxLoc = AxCyl.Location().XYZ(); //aLine.Location().XYZ(); + gp_XYZ AxDir = AxCyl.Direction().XYZ(); + Standard_Real Parameter = (OrSpine.XYZ() - AxLoc) * AxDir; + OrCyl.SetXYZ( AxLoc + Parameter * AxDir ); //construction of POnPln gp_Vec VecTranslPln,tmp; diff --git a/tests/bugs/modalg_6/bug26202 b/tests/bugs/modalg_6/bug26202 new file mode 100755 index 0000000000..489b3a775e --- /dev/null +++ b/tests/bugs/modalg_6/bug26202 @@ -0,0 +1,40 @@ +puts "============" +puts "OCC26202" +puts "============" +puts "" +####################################################################### +# Wrong result of chamfer on cylindrical surface: wrong value of chord +####################################################################### + +restore [locate_data_file bug26202_shell.brep] b + +explode b +explode b_2 e + +smallview +donly b b_2_1 +fit +xwd $imagedir/${test_image}_1.png + +chamf q b b_2_1 b_2 0.02 0.01 +explode q v +explode b v + +donly b_2 q_1 q_5 +fit +xwd $imagedir/${test_image}_2.png + +donly q b b_2 q_1 q_5 +xwd $imagedir/${test_image}_3.png + +distmini dd b_2 q_5 +dump dd_val +#dd_val is 0.013334, but must be 0.02 + +set info [dump dd_val] +regexp "\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\* Dump of dd_val \\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\n(\[-0-9*\.+eE\]+)" $info full Length + +set expected_Length 0.02 +set tol_abs_Length 1.0e-4 +set tol_rel_Length 0.0001 +checkreal "Length" ${Length} ${expected_Length} ${tol_abs_Length} ${tol_rel_Length} -- 2.20.1