mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-30 12:14:08 +03:00
0027565: [Regression to OCCT 7.0.0] Number of Intersections Is Wrong
Incorrect tolerance management is fixed. Test case is added.
This commit is contained in:
parent
1ec75a485b
commit
f84bf635f0
@ -31,6 +31,7 @@
|
|||||||
#include <OSD_Timer.hxx>
|
#include <OSD_Timer.hxx>
|
||||||
#include <TCollection_AsciiString.hxx>
|
#include <TCollection_AsciiString.hxx>
|
||||||
#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
|
#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
|
||||||
|
#include <Precision.hxx>
|
||||||
|
|
||||||
|
|
||||||
//#ifdef _MSC_VER
|
//#ifdef _MSC_VER
|
||||||
@ -66,15 +67,17 @@ static Standard_Integer distance (Draw_Interpretor& di,
|
|||||||
|
|
||||||
static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||||
{
|
{
|
||||||
Standard_Integer i1;
|
if (n != 4 && n != 5 )
|
||||||
// gp_Pnt P;
|
return 1;
|
||||||
|
|
||||||
if (n != 4) return 1;
|
|
||||||
|
|
||||||
const char *ns1 = (a[2]), *ns2 = (a[3]), *ns0 = (a[1]);
|
const char *ns1 = (a[2]), *ns2 = (a[3]), *ns0 = (a[1]);
|
||||||
TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2)) ;
|
TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2));
|
||||||
BRepExtrema_DistShapeShape dst(S1 ,S2 );
|
|
||||||
|
|
||||||
|
Standard_Real aDeflection = Precision::Confusion();
|
||||||
|
if (n == 5)
|
||||||
|
aDeflection = Draw::Atoi(a[4]);
|
||||||
|
|
||||||
|
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection);
|
||||||
|
|
||||||
if (dst.IsDone())
|
if (dst.IsDone())
|
||||||
{
|
{
|
||||||
@ -95,7 +98,7 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const
|
|||||||
Draw::Set(tempd,dst.Value());
|
Draw::Set(tempd,dst.Value());
|
||||||
di << named << " ";
|
di << named << " ";
|
||||||
|
|
||||||
for (i1=1; i1<= dst.NbSolution(); i1++)
|
for (Standard_Integer i1 = 1; i1<= dst.NbSolution(); i1++)
|
||||||
{
|
{
|
||||||
gp_Pnt P1,P2;
|
gp_Pnt P1,P2;
|
||||||
P1 = (dst.PointOnShape1(i1));
|
P1 = (dst.PointOnShape1(i1));
|
||||||
@ -416,7 +419,7 @@ void BRepTest::ExtremaCommands (Draw_Interpretor& theCommands)
|
|||||||
aGroup);
|
aGroup);
|
||||||
|
|
||||||
theCommands.Add ("distmini",
|
theCommands.Add ("distmini",
|
||||||
"distmini name Shape1 Shape2",
|
"distmini name Shape1 Shape2 [deflection]",
|
||||||
__FILE__,
|
__FILE__,
|
||||||
distmini,
|
distmini,
|
||||||
aGroup);
|
aGroup);
|
||||||
|
@ -250,10 +250,10 @@ void Extrema_GenExtCC::Perform()
|
|||||||
aFinder.SetFunctionalMinimalValue(0.0); // Best distance cannot be lower than 0.0.
|
aFinder.SetFunctionalMinimalValue(0.0); // Best distance cannot be lower than 0.0.
|
||||||
|
|
||||||
// Size computed to have cell index inside of int32 value.
|
// Size computed to have cell index inside of int32 value.
|
||||||
const Standard_Real aCellSize = Max(anIntervals1.Upper() - anIntervals1.Lower(),
|
const Standard_Real aCellSize = Max(anIntervals1.Last() - anIntervals1.First(),
|
||||||
anIntervals2.Upper() - anIntervals2.Lower())
|
anIntervals2.Last() - anIntervals2.First())
|
||||||
* Precision::PConfusion() / (2.0 * Sqrt(2.0));
|
* Precision::PConfusion() / (2.0 * Sqrt(2.0));
|
||||||
Extrema_CCPointsInspector anInspector(Precision::PConfusion());
|
Extrema_CCPointsInspector anInspector(aCellSize);
|
||||||
NCollection_CellFilter<Extrema_CCPointsInspector> aFilter(aCellSize);
|
NCollection_CellFilter<Extrema_CCPointsInspector> aFilter(aCellSize);
|
||||||
NCollection_Vector<gp_XY> aPnts;
|
NCollection_Vector<gp_XY> aPnts;
|
||||||
|
|
||||||
|
18
tests/bugs/moddata_3/bug27565
Normal file
18
tests/bugs/moddata_3/bug27565
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
puts "================"
|
||||||
|
puts "OCC27565: "
|
||||||
|
puts "================"
|
||||||
|
puts ""
|
||||||
|
####################
|
||||||
|
## [Regression to OCCT 7.0.0] Number of Intersections Is Wrong
|
||||||
|
####################
|
||||||
|
|
||||||
|
restore [locate_data_file bug27565.brep] a
|
||||||
|
explode a
|
||||||
|
|
||||||
|
# Test number of solutions in a result.
|
||||||
|
set info [distmini d a_1 a_2 1.0]
|
||||||
|
if { [llength $info] != 9 } {
|
||||||
|
puts "Error : Extrema is wrong"
|
||||||
|
} else {
|
||||||
|
puts "OK: Extrema is valid"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user