#include <OSD_Timer.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
+#include <Precision.hxx>
//#ifdef _MSC_VER
}
static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- Standard_Integer i1;
- // gp_Pnt P;
-
- if (n != 4) return 1;
+{
+ if (n != 4 && n != 5 )
+ return 1;
const char *ns1 = (a[2]), *ns2 = (a[3]), *ns0 = (a[1]);
- TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2)) ;
- BRepExtrema_DistShapeShape dst(S1 ,S2 );
+ TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2));
+
+ Standard_Real aDeflection = Precision::Confusion();
+ if (n == 5)
+ aDeflection = Draw::Atoi(a[4]);
+ BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection);
if (dst.IsDone())
{
Draw::Set(tempd,dst.Value());
di << named << " ";
- for (i1=1; i1<= dst.NbSolution(); i1++)
+ for (Standard_Integer i1 = 1; i1<= dst.NbSolution(); i1++)
{
gp_Pnt P1,P2;
P1 = (dst.PointOnShape1(i1));
aGroup);
theCommands.Add ("distmini",
- "distmini name Shape1 Shape2",
+ "distmini name Shape1 Shape2 [deflection]",
__FILE__,
distmini,
aGroup);
aFinder.SetFunctionalMinimalValue(0.0); // Best distance cannot be lower than 0.0.
// Size computed to have cell index inside of int32 value.
- const Standard_Real aCellSize = Max(anIntervals1.Upper() - anIntervals1.Lower(),
- anIntervals2.Upper() - anIntervals2.Lower())
+ const Standard_Real aCellSize = Max(anIntervals1.Last() - anIntervals1.First(),
+ anIntervals2.Last() - anIntervals2.First())
* Precision::PConfusion() / (2.0 * Sqrt(2.0));
- Extrema_CCPointsInspector anInspector(Precision::PConfusion());
+ Extrema_CCPointsInspector anInspector(aCellSize);
NCollection_CellFilter<Extrema_CCPointsInspector> aFilter(aCellSize);
NCollection_Vector<gp_XY> aPnts;
--- /dev/null
+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"
+}