mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-07-05 12:15:50 +03:00
0023863: Wrong distance value between circle and cylinder
The verification of intersection of a circle and a cylinder was added to the calculation of extrema Test cases for issue CR23863
This commit is contained in:
parent
7dc9e04716
commit
198753532d
@ -314,8 +314,15 @@ void Extrema_ExtElCS::Perform(const gp_Circ& C,
|
|||||||
Standard_Real aTolConf = Precision::Confusion();
|
Standard_Real aTolConf = Precision::Confusion();
|
||||||
Standard_Real aCylRad = S.Radius();
|
Standard_Real aCylRad = S.Radius();
|
||||||
|
|
||||||
|
// Check whether two objects have intersection points
|
||||||
|
IntAna_Quadric aCylQuad(S);
|
||||||
|
IntAna_IntConicQuad aCircCylInter(C, aCylQuad);
|
||||||
|
Standard_Integer aNbInter = aCircCylInter.NbPoints();
|
||||||
|
if (!aCircCylInter.IsDone())
|
||||||
|
aNbInter = 0;
|
||||||
|
|
||||||
// Compute the extremas.
|
// Compute the extremas.
|
||||||
myNbExt = 2*aNbExt;
|
myNbExt = 2*aNbExt + aNbInter;
|
||||||
mySqDist = new TColStd_HArray1OfReal(1, myNbExt);
|
mySqDist = new TColStd_HArray1OfReal(1, myNbExt);
|
||||||
myPoint1 = new Extrema_HArray1OfPOnCurv(1, myNbExt);
|
myPoint1 = new Extrema_HArray1OfPOnCurv(1, myNbExt);
|
||||||
myPoint2 = new Extrema_HArray1OfPOnSurf(1, myNbExt);
|
myPoint2 = new Extrema_HArray1OfPOnSurf(1, myNbExt);
|
||||||
@ -328,13 +335,12 @@ void Extrema_ExtElCS::Perform(const gp_Circ& C,
|
|||||||
|
|
||||||
anExtC.Points(i, aPOnAxis, aPOnCirc);
|
anExtC.Points(i, aPOnAxis, aPOnCirc);
|
||||||
|
|
||||||
if (aSqDist <= (aTolConf * aTolConf) || aCenter.IsEqual(aPOnAxis.Value(), aTolConf)) {
|
if (aSqDist <= (aTolConf * aTolConf)) {
|
||||||
myNbExt -= 2;
|
myNbExt -= 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
gp_Dir aDir(aPOnAxis.Value().XYZ().
|
gp_Dir aDir(aPOnAxis.Value().XYZ().Subtracted(aPOnCirc.Value().XYZ()));
|
||||||
Subtracted(aPOnCirc.Value().XYZ()));
|
|
||||||
Standard_Real aShift[2] = { aDist + aCylRad, aDist - aCylRad };
|
Standard_Real aShift[2] = { aDist + aCylRad, aDist - aCylRad };
|
||||||
Standard_Integer j;
|
Standard_Integer j;
|
||||||
|
|
||||||
@ -357,6 +363,24 @@ void Extrema_ExtElCS::Perform(const gp_Circ& C,
|
|||||||
mySqDist->SetValue(aCurI++, aShift[j] * aShift[j]);
|
mySqDist->SetValue(aCurI++, aShift[j] * aShift[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adding intersection points to the list of extremas
|
||||||
|
for (i=1; i<=aNbInter; i++)
|
||||||
|
{
|
||||||
|
Standard_Real aU;
|
||||||
|
Standard_Real aV;
|
||||||
|
|
||||||
|
gp_Pnt aInterPnt = aCircCylInter.Point(i);
|
||||||
|
|
||||||
|
aU = ElCLib::Parameter(C, aInterPnt);
|
||||||
|
Extrema_POnCurv aPOnCirc(aU, aInterPnt);
|
||||||
|
|
||||||
|
ElSLib::Parameters(S, aInterPnt, aU, aV);
|
||||||
|
Extrema_POnSurf aPOnCyl(aU, aV, aInterPnt);
|
||||||
|
myPoint1->SetValue(aCurI, aPOnCirc);
|
||||||
|
myPoint2->SetValue(aCurI, aPOnCyl);
|
||||||
|
mySqDist->SetValue(aCurI++, 0.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myDone = Standard_True;
|
myDone = Standard_True;
|
||||||
|
38
tests/bugs/moddata_3/bug23863
Executable file
38
tests/bugs/moddata_3/bug23863
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
puts "================"
|
||||||
|
puts "OCC23863"
|
||||||
|
puts "================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Wrong distance value between circle and cylinder
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
pcylinder b1 10 10
|
||||||
|
explode b1 f
|
||||||
|
copy b1_1 b1
|
||||||
|
circle b2 0 10 10 1 0 0 5
|
||||||
|
mkedge b2 b2
|
||||||
|
|
||||||
|
distmini d b1 b2
|
||||||
|
|
||||||
|
regexp {([-0-9.+eE]+)$} [dump d_val] full dist
|
||||||
|
regexp { +Vertex +: +Min +[-0-9.+eE]+ +Max +([-0-9.+eE]+)} [ maxtolerance d ] full toler
|
||||||
|
set good_dist 0
|
||||||
|
if { [expr abs( ${dist} - ${good_dist} )] > ${toler} } {
|
||||||
|
puts "Faulty : the distanse is ${dist}. It is bad value"
|
||||||
|
}
|
||||||
|
|
||||||
|
regexp { +Point 3D : +([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} [ dump d ] full x y z
|
||||||
|
set good_x 0
|
||||||
|
set good_y 10
|
||||||
|
set good_z 5
|
||||||
|
if { [expr abs( ${x} - ${good_x} )] > ${toler} } {
|
||||||
|
puts "Faulty : the x coordinate of the point is ${x}. It is bad value"
|
||||||
|
}
|
||||||
|
if { [expr abs( ${y} - ${good_y} )] > ${toler} } {
|
||||||
|
puts "Faulty : the y coordinate of the point is ${y}. It is bad value"
|
||||||
|
}
|
||||||
|
if { [expr abs( ${z} - ${good_z} )] > ${toler} } {
|
||||||
|
puts "Faulty : the z coordinate of the point is ${z}. It is bad value"
|
||||||
|
}
|
||||||
|
|
||||||
|
set 2dviewer 1
|
Loading…
x
Reference in New Issue
Block a user