mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0029655: [Regression to 6.9.1] Distance between cylinder and straight line
Trimming line by corner points of surface bounding box is added to reduce rang of line Test case added
This commit is contained in:
parent
80d55adf7c
commit
4563cf3e6c
@ -23,8 +23,6 @@
|
|||||||
#include <ElCLib.hxx>
|
#include <ElCLib.hxx>
|
||||||
#include <ElSLib.hxx>
|
#include <ElSLib.hxx>
|
||||||
#include <Extrema_ExtCS.hxx>
|
#include <Extrema_ExtCS.hxx>
|
||||||
#include <Extrema_ExtPElC.hxx>
|
|
||||||
#include <Extrema_ExtPElS.hxx>
|
|
||||||
#include <Extrema_ExtPS.hxx>
|
#include <Extrema_ExtPS.hxx>
|
||||||
#include <Extrema_GenExtCS.hxx>
|
#include <Extrema_GenExtCS.hxx>
|
||||||
#include <Extrema_POnCurv.hxx>
|
#include <Extrema_POnCurv.hxx>
|
||||||
@ -147,24 +145,16 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
|
|||||||
Standard_Real ufirst = myS->FirstUParameter(), ulast = myS->LastUParameter(),
|
Standard_Real ufirst = myS->FirstUParameter(), ulast = myS->LastUParameter(),
|
||||||
vfirst = myS->FirstVParameter(), vlast = myS->LastVParameter();
|
vfirst = myS->FirstVParameter(), vlast = myS->LastVParameter();
|
||||||
|
|
||||||
if(Precision::IsInfinite(Abs(cfirst)) || Precision::IsInfinite(Abs(clast))) {
|
if (!(Precision::IsInfinite(ufirst) || Precision::IsInfinite(ulast) ||
|
||||||
|
Precision::IsInfinite(vfirst) || Precision::IsInfinite(vlast)))
|
||||||
|
{
|
||||||
|
Standard_Real tmin = Precision::Infinite(), tmax = -tmin;
|
||||||
|
Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
|
||||||
Bnd_Box aSurfBox;
|
Bnd_Box aSurfBox;
|
||||||
BndLib_AddSurface::Add(*myS, ufirst, ulast, vfirst, vlast, Precision::Confusion(), aSurfBox);
|
BndLib_AddSurface::Add(*myS, ufirst, ulast, vfirst, vlast, Precision::Confusion(), aSurfBox);
|
||||||
Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
|
|
||||||
aSurfBox.Get(xmin, ymin, zmin, xmax, ymax, zmax);
|
aSurfBox.Get(xmin, ymin, zmin, xmax, ymax, zmax);
|
||||||
Standard_Real tmin = Precision::Infinite(), tmax = -tmin;
|
|
||||||
gp_Lin aLin = C.Line();
|
gp_Lin aLin = C.Line();
|
||||||
|
|
||||||
|
|
||||||
if(!( Precision::IsInfinite(Abs(xmin)) || Precision::IsInfinite(Abs(xmax)) ||
|
|
||||||
Precision::IsInfinite(Abs(ymin)) || Precision::IsInfinite(Abs(ymax)) ||
|
|
||||||
Precision::IsInfinite(Abs(zmin)) || Precision::IsInfinite(Abs(zmax))) ) {
|
|
||||||
|
|
||||||
Extrema_ExtPElC anExt;
|
|
||||||
Extrema_POnCurv aPntOnLin;
|
|
||||||
Standard_Real aParOnLin;
|
Standard_Real aParOnLin;
|
||||||
Standard_Real lim = Precision::Infinite();
|
|
||||||
gp_Pnt aLimPntArray[8];
|
gp_Pnt aLimPntArray[8];
|
||||||
|
|
||||||
aLimPntArray[0].SetCoord(xmin, ymin, zmin);
|
aLimPntArray[0].SetCoord(xmin, ymin, zmin);
|
||||||
@ -176,24 +166,13 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
|
|||||||
aLimPntArray[6].SetCoord(xmin, ymax, zmax);
|
aLimPntArray[6].SetCoord(xmin, ymax, zmax);
|
||||||
aLimPntArray[7].SetCoord(xmax, ymax, zmax);
|
aLimPntArray[7].SetCoord(xmax, ymax, zmax);
|
||||||
|
|
||||||
for(i = 0; i <= 7; i++) {
|
for (i = 0; i <= 7; i++) {
|
||||||
anExt.Perform(aLimPntArray[i], aLin, Precision::Confusion(), -lim, lim);
|
aParOnLin = ElCLib::Parameter(aLin, aLimPntArray[i]);
|
||||||
aPntOnLin = anExt.Point(1);
|
|
||||||
aParOnLin = aPntOnLin.Parameter();
|
|
||||||
tmin = Min(aParOnLin, tmin);
|
tmin = Min(aParOnLin, tmin);
|
||||||
tmax = Max(aParOnLin, tmax);
|
tmax = Max(aParOnLin, tmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tmin = -1.e+50;
|
|
||||||
tmax = 1.e+50;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cfirst = Max(cfirst, tmin);
|
cfirst = Max(cfirst, tmin);
|
||||||
clast = Min(clast, tmax);
|
clast = Min(clast, tmax);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myS->IsUPeriodic())
|
if (myS->IsUPeriodic())
|
||||||
@ -219,7 +198,6 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
19
tests/bugs/modalg_7/bug29655
Normal file
19
tests/bugs/modalg_7/bug29655
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC29655"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
#################################################
|
||||||
|
# 0029655: [Regression to 6.9.1] Distance between cylinder and straight line
|
||||||
|
#################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug29655.brep] s
|
||||||
|
explode s
|
||||||
|
distmini res s_1 s_2
|
||||||
|
|
||||||
|
|
||||||
|
if { [isdraw res] } {
|
||||||
|
checknbshapes res -vertex 1 -edge 0
|
||||||
|
} else { puts "Error : result of distmini is wrong" }
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user