mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024766: Wrong result for distmini between a TopoDS_Shell and a TopoDS_Edge on version 6.6.0.
This commit is contained in:
parent
16e15f4ecc
commit
93c85fddfd
@ -43,8 +43,11 @@ void BRepExtrema_ExtCC::Initialize(const TopoDS_Edge& E2)
|
|||||||
Standard_Real V1,V2;
|
Standard_Real V1,V2;
|
||||||
BRepAdaptor_Curve Curv(E2);
|
BRepAdaptor_Curve Curv(E2);
|
||||||
myHC = new BRepAdaptor_HCurve(Curv);
|
myHC = new BRepAdaptor_HCurve(Curv);
|
||||||
|
Standard_Real Tol = Min(BRep_Tool::Tolerance(E2), Precision::Confusion());
|
||||||
|
Tol = Max(Curv.Resolution(Tol), Precision::PConfusion());
|
||||||
BRep_Tool::Range(E2,V1,V2);
|
BRep_Tool::Range(E2,V1,V2);
|
||||||
myExtCC.SetCurve(2,myHC->Curve(),V1,V2);
|
myExtCC.SetCurve(2,myHC->Curve(),V1,V2);
|
||||||
|
myExtCC.SetTolerance(2, Tol);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -57,8 +60,11 @@ void BRepExtrema_ExtCC::Perform(const TopoDS_Edge& E1)
|
|||||||
Standard_Real U1, U2;
|
Standard_Real U1, U2;
|
||||||
BRepAdaptor_Curve Curv(E1);
|
BRepAdaptor_Curve Curv(E1);
|
||||||
Handle(BRepAdaptor_HCurve) HC = new BRepAdaptor_HCurve(Curv);
|
Handle(BRepAdaptor_HCurve) HC = new BRepAdaptor_HCurve(Curv);
|
||||||
|
Standard_Real Tol = Min(BRep_Tool::Tolerance(E1), Precision::Confusion());
|
||||||
|
Tol = Max(Curv.Resolution(Tol), Precision::PConfusion());
|
||||||
BRep_Tool::Range(E1,U1,U2);
|
BRep_Tool::Range(E1,U1,U2);
|
||||||
myExtCC.SetCurve (1, HC->Curve(), U1, U2);
|
myExtCC.SetCurve (1, HC->Curve(), U1, U2);
|
||||||
|
myExtCC.SetTolerance(1, Tol);
|
||||||
myExtCC.Perform();
|
myExtCC.Perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
BRepExtrema_ExtCF::BRepExtrema_ExtCF(const TopoDS_Edge& E, const TopoDS_Face& F)
|
BRepExtrema_ExtCF::BRepExtrema_ExtCF(const TopoDS_Edge& E, const TopoDS_Face& F)
|
||||||
{
|
{
|
||||||
Initialize(F);
|
Initialize(E, F);
|
||||||
Perform(E, F);
|
Perform(E, F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,14 +42,24 @@ BRepExtrema_ExtCF::BRepExtrema_ExtCF(const TopoDS_Edge& E, const TopoDS_Face& F)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void BRepExtrema_ExtCF::Initialize(const TopoDS_Face& F2)
|
void BRepExtrema_ExtCF::Initialize(const TopoDS_Edge& E, const TopoDS_Face& F)
|
||||||
{
|
{
|
||||||
BRepAdaptor_Surface Surf(F2);
|
BRepAdaptor_Surface Surf(F);
|
||||||
|
BRepAdaptor_Curve aC(E);
|
||||||
myHS = new BRepAdaptor_HSurface(Surf);
|
myHS = new BRepAdaptor_HSurface(Surf);
|
||||||
const Standard_Real Tol = BRep_Tool::Tolerance(F2);
|
Standard_Real aTolC, aTolS;
|
||||||
|
//
|
||||||
|
aTolS = Min(BRep_Tool::Tolerance(F), Precision::Confusion());
|
||||||
|
aTolS = Min(Surf.UResolution(aTolS), Surf.VResolution(aTolS));
|
||||||
|
aTolS = Max(aTolS, Precision::PConfusion());
|
||||||
|
//
|
||||||
|
aTolC = Min(BRep_Tool::Tolerance(E), Precision::Confusion());
|
||||||
|
aTolC = aC.Resolution(aTolC);
|
||||||
|
aTolC = Max(aTolC, Precision::PConfusion());
|
||||||
|
//
|
||||||
Standard_Real U1, U2, V1, V2;
|
Standard_Real U1, U2, V1, V2;
|
||||||
BRepTools::UVBounds(F2, U1, U2, V1, V2);
|
BRepTools::UVBounds(F, U1, U2, V1, V2);
|
||||||
myExtCS.Initialize(myHS->Surface(), U1, U2, V1, V2, Tol, Tol);
|
myExtCS.Initialize(myHS->Surface(), U1, U2, V1, V2, aTolC, aTolS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -70,12 +70,12 @@ class BRepExtrema_ExtCF
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
//! It calculates all the distances. <br>
|
//! It calculates all the distances. <br>
|
||||||
Standard_EXPORT BRepExtrema_ExtCF(const TopoDS_Edge& V,const TopoDS_Face& E);
|
Standard_EXPORT BRepExtrema_ExtCF(const TopoDS_Edge& E,const TopoDS_Face& F);
|
||||||
|
|
||||||
Standard_EXPORT void Initialize(const TopoDS_Face& E);
|
Standard_EXPORT void Initialize(const TopoDS_Edge& E, const TopoDS_Face& F);
|
||||||
//! An exception is raised if the fields have not been initialized. <br>
|
//! An exception is raised if the fields have not been initialized. <br>
|
||||||
//! Be careful: this method uses the Face only for classify not for the fields. <br>
|
//! Be careful: this method uses the Face only for classify not for the fields. <br>
|
||||||
Standard_EXPORT void Perform(const TopoDS_Edge& V,const TopoDS_Face& F);
|
Standard_EXPORT void Perform(const TopoDS_Edge& E,const TopoDS_Face& F);
|
||||||
//! True if the distances are found. <br>
|
//! True if the distances are found. <br>
|
||||||
Standard_EXPORT Standard_Boolean IsDone() const
|
Standard_EXPORT Standard_Boolean IsDone() const
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,9 @@ void BRepExtrema_ExtFF::Initialize(const TopoDS_Face& F2)
|
|||||||
{
|
{
|
||||||
BRepAdaptor_Surface Surf(F2);
|
BRepAdaptor_Surface Surf(F2);
|
||||||
myHS = new BRepAdaptor_HSurface(Surf);
|
myHS = new BRepAdaptor_HSurface(Surf);
|
||||||
const Standard_Real Tol = BRep_Tool::Tolerance(F2);
|
Standard_Real Tol = Min(BRep_Tool::Tolerance(F2), Precision::Confusion());
|
||||||
|
Tol = Min(Surf.UResolution(Tol), Surf.VResolution(Tol));
|
||||||
|
Tol = Max(Tol, Precision::PConfusion());
|
||||||
Standard_Real U1, U2, V1, V2;
|
Standard_Real U1, U2, V1, V2;
|
||||||
BRepTools::UVBounds(F2, U1, U2, V1, V2);
|
BRepTools::UVBounds(F2, U1, U2, V1, V2);
|
||||||
myExtSS.Initialize(myHS->Surface(), U1, U2, V1, V2, Tol);
|
myExtSS.Initialize(myHS->Surface(), U1, U2, V1, V2, Tol);
|
||||||
@ -66,7 +68,9 @@ void BRepExtrema_ExtFF::Perform(const TopoDS_Face& F1, const TopoDS_Face& F2)
|
|||||||
|
|
||||||
BRepAdaptor_Surface Surf1(F1);
|
BRepAdaptor_Surface Surf1(F1);
|
||||||
Handle(BRepAdaptor_HSurface) HS1 = new BRepAdaptor_HSurface(Surf1);
|
Handle(BRepAdaptor_HSurface) HS1 = new BRepAdaptor_HSurface(Surf1);
|
||||||
const Standard_Real Tol1 = BRep_Tool::Tolerance(F1);
|
Standard_Real Tol1 = Min(BRep_Tool::Tolerance(F1), Precision::Confusion());
|
||||||
|
Tol1 = Min(Surf1.UResolution(Tol1), Surf1.VResolution(Tol1));
|
||||||
|
Tol1 = Max(Tol1, Precision::PConfusion());
|
||||||
Standard_Real U1, U2, V1, V2;
|
Standard_Real U1, U2, V1, V2;
|
||||||
BRepTools::UVBounds(F1, U1, U2, V1, V2);
|
BRepTools::UVBounds(F1, U1, U2, V1, V2);
|
||||||
myExtSS.Perform(HS1->Surface(), U1, U2, V1, V2, Tol1);
|
myExtSS.Perform(HS1->Surface(), U1, U2, V1, V2, Tol1);
|
||||||
|
@ -44,8 +44,10 @@ void BRepExtrema_ExtPC::Initialize(const TopoDS_Edge& E)
|
|||||||
Standard_Real U1,U2;
|
Standard_Real U1,U2;
|
||||||
BRepAdaptor_Curve Curv(E);
|
BRepAdaptor_Curve Curv(E);
|
||||||
myHC = new BRepAdaptor_HCurve(Curv);
|
myHC = new BRepAdaptor_HCurve(Curv);
|
||||||
|
Standard_Real Tol = Min(BRep_Tool::Tolerance(E), Precision::Confusion());
|
||||||
|
Tol = Max(Curv.Resolution(Tol), Precision::PConfusion());
|
||||||
BRep_Tool::Range(E,U1,U2);
|
BRep_Tool::Range(E,U1,U2);
|
||||||
myExtPC.Initialize(myHC->Curve(),U1,U2);
|
myExtPC.Initialize(myHC->Curve(),U1,U2,Tol);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <BRepClass_FaceClassifier.hxx>
|
#include <BRepClass_FaceClassifier.hxx>
|
||||||
#include <gp_Pnt2d.hxx>
|
#include <gp_Pnt2d.hxx>
|
||||||
#include <BRepAdaptor_Surface.hxx>
|
#include <BRepAdaptor_Surface.hxx>
|
||||||
|
#include <Precision.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : BRepExtrema_ExtPF
|
//function : BRepExtrema_ExtPF
|
||||||
@ -48,12 +49,15 @@ void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
|
|||||||
// cette surface doit etre en champ. Extrema ne fait
|
// cette surface doit etre en champ. Extrema ne fait
|
||||||
// pas de copie et prend seulement un pointeur dessus.
|
// pas de copie et prend seulement un pointeur dessus.
|
||||||
mySurf.Initialize(TheFace, Standard_False);
|
mySurf.Initialize(TheFace, Standard_False);
|
||||||
const Standard_Real Tol = BRep_Tool::Tolerance(TheFace);
|
Standard_Real Tol = Min(BRep_Tool::Tolerance(TheFace), Precision::Confusion());
|
||||||
|
Standard_Real aTolU, aTolV;
|
||||||
|
aTolU = Max(mySurf.UResolution(Tol), Precision::PConfusion());
|
||||||
|
aTolV = Max(mySurf.VResolution(Tol), Precision::PConfusion());
|
||||||
Standard_Real U1, U2, V1, V2;
|
Standard_Real U1, U2, V1, V2;
|
||||||
BRepTools::UVBounds(TheFace, U1, U2, V1, V2);
|
BRepTools::UVBounds(TheFace, U1, U2, V1, V2);
|
||||||
myExtPS.SetFlag(TheFlag);
|
myExtPS.SetFlag(TheFlag);
|
||||||
myExtPS.SetAlgo(TheAlgo);
|
myExtPS.SetAlgo(TheAlgo);
|
||||||
myExtPS.Initialize(mySurf, U1, U2, V1, V2, Tol, Tol);
|
myExtPS.Initialize(mySurf, U1, U2, V1, V2, aTolU, aTolV);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
25
tests/bugs/modalg_5/bug24766
Normal file
25
tests/bugs/modalg_5/bug24766
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC24766"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#################################################
|
||||||
|
# Wrong result for distmini between a TopoDS_Shell and a TopoDS_Edge on version 6.6.0.
|
||||||
|
#################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug24766_shell_for_points.brep] s1
|
||||||
|
restore [locate_data_file bug24766_edge_to_line.brep] e1
|
||||||
|
|
||||||
|
set dist_list [distmini d s1 e1]
|
||||||
|
if { [llength ${dist_list}] != 2 } {
|
||||||
|
puts "Error: bad number of solutions"
|
||||||
|
} else {
|
||||||
|
puts "OK: good number of solutions"
|
||||||
|
}
|
||||||
|
|
||||||
|
regexp {([-0-9.+eE]+)} [dump d_val] full dist
|
||||||
|
|
||||||
|
set expected_dist 2.09628394812595e-15
|
||||||
|
set tol_abs_dist 1.0e-12
|
||||||
|
set tol_rel_dist 0.001
|
||||||
|
|
||||||
|
checkreal "Minimal distantion" ${dist} ${expected_dist} ${tol_abs_dist} ${tol_rel_dist}
|
Loading…
x
Reference in New Issue
Block a user