1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0026884: Cylinder/Cylinder intersection algorithm throws an exception

Check, if cylinder axes are parallel is made more carefully.
This check is brought to conformity with check if axes are parallel (see constructor AxeOperator::AxeOperator(...) in IntAna_QuadQuadGeo.cxx file)

Test case for issue CR26884

(cherry picked from commit ce48b00930)
This commit is contained in:
nbv
2015-11-18 11:01:12 +03:00
parent 074eb06e7a
commit 507dd6d579
3 changed files with 49 additions and 9 deletions

View File

@@ -118,8 +118,8 @@ class AxeOperator {
//=======================================================================
AxeOperator::AxeOperator(const gp_Ax1& A1,const gp_Ax1& A2)
{
myEPSILON_DISTANCE=0.00000000000001;
myEPSILON_AXES_PARA=0.000000000001;
myEPSILON_DISTANCE=1.0e-14;
myEPSILON_AXES_PARA=Precision::Angular();
Axe1=A1;
Axe2=A2;
//---------------------------------------------------------------------
@@ -268,12 +268,12 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(void)
//=======================================================================
void IntAna_QuadQuadGeo::InitTolerances()
{
myEPSILON_DISTANCE = 0.00000000000001;
myEPSILON_ANGLE_CONE = 0.000000000001;
myEPSILON_MINI_CIRCLE_RADIUS = 0.000000001;
myEPSILON_CYLINDER_DELTA_RADIUS = 0.0000000000001;
myEPSILON_CYLINDER_DELTA_DISTANCE= 0.0000001;
myEPSILON_AXES_PARA = 0.000000000001;
myEPSILON_DISTANCE = 1.0e-14;
myEPSILON_ANGLE_CONE = Precision::Angular();
myEPSILON_MINI_CIRCLE_RADIUS = 0.01*Precision::Confusion();
myEPSILON_CYLINDER_DELTA_RADIUS = 1.0e-13;
myEPSILON_CYLINDER_DELTA_DISTANCE= Precision::Confusion();
myEPSILON_AXES_PARA = Precision::Angular();
}
//=======================================================================
//function : IntAna_QuadQuadGeo

View File

@@ -1022,7 +1022,13 @@ stCoeffsValue::stCoeffsValue( const gp_Cylinder& theCyl1,
}
}
if(Abs(aDetV1V2) < aNulValue)
// In point of fact, every determinant (aDelta1, aDelta2 and aDelta3) is
// cross-product between directions (i.e. sine of angle).
// If sine is too small then sine is (approx.) equal to angle itself.
// Therefore, in this case we should compare sine with angular tolerance.
// This constant is used for check if axes are parallel (see constructor
// AxeOperator::AxeOperator(...) in IntAna_QuadQuadGeo.cxx file).
if(Abs(aDetV1V2) < Precision::Angular())
{
Standard_Failure::Raise("Error. Exception in divide by zerro (IntCyCyTrim)!!!!");
}

View File

@@ -0,0 +1,34 @@
puts "================"
puts "OCC26884"
puts "================"
puts ""
##############################################################
# Cylinder/Cylinder intersection algorithm throws an exception
##############################################################
set max_time 0.1
restore [locate_data_file bug26884-f1.brep] f1
restore [locate_data_file bug26884-f2.brep] f2
dchrono cr reset
dchrono cr start
set info [bopcurves f1 f2 -2d]
dchrono cr stop
if {![regexp {has no 3d curves} $info] ||
![regexp {has no 3d points} $info] } {
puts "Error: wrong output"
}
set logTime [dchrono cr show]
regexp {CPU user time: ([-0-9.+eE]+) seconds} $logTime full z
if { $z > ${max_time} } {
puts "Elapsed time ($z) is more than ${max_time} seconds - Error"
} else {
puts "Elapsed time ($z) is less than ${max_time} seconds - OK"
}