mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0024945: Extrema_ExtPElC::Perform does not consider angular tolerance when calculates angle between two vectors
Consider angular tolerance during calculation of angle between two vectors for protection against deviations that are significantly less than tolerance. Simplified code to reduce number of comparison Added QA command OCC24945 and test case bugs/moddata_3/bug24945
This commit is contained in:
parent
5e5b6f81c1
commit
c764e804ba
@ -124,6 +124,13 @@ Method:
|
||||
if (OPp.Magnitude() < Tol) { return; }
|
||||
Standard_Real Usol[2];
|
||||
Usol[0] = C.XAxis().Direction().AngleWithRef(OPp,Axe); // -M_PI<U1<M_PI
|
||||
|
||||
const Standard_Real aAngTol = Precision::Angular();
|
||||
if ( Usol[0] + M_PI < aAngTol )
|
||||
Usol[0] = -M_PI;
|
||||
else if ( Usol[0] - M_PI > -aAngTol )
|
||||
Usol[0] = M_PI;
|
||||
|
||||
Usol[1] = Usol[0] + M_PI;
|
||||
|
||||
Standard_Real myuinf = Uinf;
|
||||
|
@ -1380,6 +1380,39 @@ static Standard_Integer OCC24086 (Draw_Interpretor& di, Standard_Integer argc, c
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <Extrema_ExtPC.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
static Standard_Integer OCC24945 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
||||
{
|
||||
if (argc != 1) {
|
||||
di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
gp_Pnt aP3D( -1725.97, 843.257, -4.22741e-013 );
|
||||
gp_Ax2 aAxis( gp_Pnt( 0, 843.257, 0 ), gp_Dir( 0, -1, 0 ), gp::DX() );
|
||||
Handle(Geom_Circle) aCircle = new Geom_Circle( aAxis, 1725.9708621929999 );
|
||||
GeomAdaptor_Curve aC3D( aCircle );
|
||||
|
||||
Extrema_ExtPC aExtPC( aP3D, aC3D );
|
||||
//Standard_Real aParam = (aExtPC.Point(1)).Parameter();
|
||||
gp_Pnt aProj = (aExtPC.Point(1)).Value();
|
||||
di << "Projected point: X = " << aProj.X() << "; Y = " << aProj.Y() << "; Z = " << aProj.Z() << "\n";
|
||||
|
||||
// Result of deviation
|
||||
gp_Ax2 aCylAxis( gp_Pnt( 0, 2103.87, 0 ), -gp::DY(), -gp::DX() );
|
||||
gp_Cylinder aCylinder( aCylAxis, 1890. );
|
||||
|
||||
Standard_Real aU = 0., aV = 0.;
|
||||
ElSLib::Parameters( aCylinder, aProj, aU, aV );
|
||||
di << "Parameters on cylinder: U = " << aU << "; V = " << aV << "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <Extrema_FuncExtPS.hxx>
|
||||
#include <math_FunctionSetRoot.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
@ -2365,5 +2398,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
||||
theCommands.Add ("OCC24889", "OCC24889", __FILE__, OCC24889, group);
|
||||
theCommands.Add ("OCC23951", "OCC23951", __FILE__, OCC23951, group);
|
||||
theCommands.Add ("OCC24931", "OCC24931", __FILE__, OCC24931, group);
|
||||
theCommands.Add ("OCC24945", "OCC24945", __FILE__, OCC24945, group);
|
||||
return;
|
||||
}
|
||||
|
27
tests/bugs/moddata_3/bug24945
Normal file
27
tests/bugs/moddata_3/bug24945
Normal file
@ -0,0 +1,27 @@
|
||||
puts "============"
|
||||
puts "OCC24945"
|
||||
puts "============"
|
||||
puts ""
|
||||
##########################################################################################################
|
||||
# Extrema_ExtPElC::Perform does not consider angular tolerance when calculates angle between two vectors
|
||||
##########################################################################################################
|
||||
|
||||
pload QAcommands
|
||||
|
||||
set info [OCC24945]
|
||||
regexp {Projected point: +X += +([-0-9.+eE]+); +Y += +([-0-9.+eE]+); +Z += +([-0-9.+eE]+)} $info full aX aY aZ
|
||||
regexp {Parameters on cylinder: +U += +([-0-9.+eE]+); +V += +([-0-9.+eE]+)} $info full aU aV
|
||||
|
||||
set expected_X -1725.97
|
||||
set expected_Y 843.26
|
||||
set expected_Z 2.1137e-013
|
||||
set expected_U 6.2832
|
||||
set expected_V 1260.6
|
||||
set tol_abs_dist 1.0e-12
|
||||
set tol_rel_dist 0.1
|
||||
|
||||
checkreal "Point X" ${aX} ${expected_X} ${tol_abs_dist} ${tol_rel_dist}
|
||||
checkreal "Point Y" ${aY} ${expected_Y} ${tol_abs_dist} ${tol_rel_dist}
|
||||
checkreal "Point Z" ${aZ} ${expected_Z} ${tol_abs_dist} ${tol_rel_dist}
|
||||
checkreal "Point U" ${aU} ${expected_U} ${tol_abs_dist} ${tol_rel_dist}
|
||||
checkreal "Point V" ${aV} ${expected_V} ${tol_abs_dist} ${tol_rel_dist}
|
Loading…
x
Reference in New Issue
Block a user