#include <ModelAPI_Document.h>
#include <ModelAPI_BodyBuilder.h>
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
#include <sstream>
+
static const std::string INTERSECTION_VERSION_1("v9.5");
//=================================================================================================
AttributePtr anObjectsAttr = data()->addAttribute(OBJECT_LIST_ID(),
ModelAPI_AttributeSelectionList::typeId());
+ data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId());
+ // Initialize the fuzzy parameter with a value below Precision::Confusion() to indicate,
+ // that the internal algorithms should use their default fuzzy value, if none was specified
+ // by the user.
+ real(FUZZY_PARAM_ID())->setValue(1.e-8);
+
initVersion(INTERSECTION_VERSION_1, anObjectsAttr, AttributePtr());
}
return;
}
+ // Getting fuzzy parameter.
+ // Used as additional tolerance to eliminate tiny results.
+ double aFuzzy = real(FUZZY_PARAM_ID())->value();
+
int aResultIndex = 0;
// Create result.
const ListOfShape& anObjects = anObjectsHierarchy.objects();
- GeomMakeShapePtr anIntersectionAlgo(new GeomAlgoAPI_Intersection(anObjects));
+ GeomMakeShapePtr anIntersectionAlgo(new GeomAlgoAPI_Intersection(anObjects, aFuzzy));
// Checking that the algorithm worked properly.
std::string anError;