#1960 make configurable

This commit is contained in:
Thomas Krijnen
2022-01-09 15:15:29 +01:00
parent 2683bcba20
commit 6246dda8d6
6 changed files with 26 additions and 7 deletions
+1
View File
@@ -274,6 +274,7 @@ private:
double no_wire_intersection_tolerance;
double precision_factor;
double boolean_debug_setting;
double boolean_attempt_2d;
size_t operation_counter_ = 0;
+10 -4
View File
@@ -1782,6 +1782,9 @@ void IfcGeom::Kernel::setValue(GeomValue var, double value) {
case GV_DEBUG_BOOLEAN:
boolean_debug_setting = value;
break;
case GV_BOOLEAN_ATTEMPT_2D:
boolean_attempt_2d = value;
break;
default:
throw std::runtime_error("Invalid setting");
}
@@ -1819,6 +1822,8 @@ double IfcGeom::Kernel::getValue(GeomValue var) const {
return no_wire_intersection_tolerance;
case GV_DEBUG_BOOLEAN:
return boolean_debug_setting;
case GV_BOOLEAN_ATTEMPT_2D:
return boolean_attempt_2d;
}
throw std::runtime_error("Invalid setting");
}
@@ -4665,8 +4670,8 @@ namespace {
if (u11 < U1 && U1 < u12 && u21 < U2 && U2 < u22) {
// Edge curves belonging to different operands intersect, don't process
// using builder.
return false;
Logger::Notice("Intersecting boundaries");
return false;
}
}
}
@@ -4772,8 +4777,9 @@ bool IfcGeom::Kernel::boolean_operation(const TopoDS_Shape& a_input, const TopTo
const bool do_unify = true;
const bool do_subtraction_eliminate_disjoint_bbox = true;
const bool do_subtraction_eliminate_touching = true;
const bool do_attempt_2d_boolean = getValue(GV_BOOLEAN_ATTEMPT_2D) > 0.;
const bool debug = getValue(GV_DEBUG_BOOLEAN) > 0.;
std::string debug_identifier;
if (debug) {
std::stringstream ss;
@@ -4906,8 +4912,8 @@ bool IfcGeom::Kernel::boolean_operation(const TopoDS_Shape& a_input, const TopTo
TopTools_ListOfShape b_faces, b_remainder_3d;
bool is_extrusion_a;
{
bool is_extrusion_a = false;
if (do_attempt_2d_boolean) {
PERF("boolean subtraction: extrusion check");
is_extrusion_a = is_extrusion(gp::DY(), a, a_face, a_interval);
@@ -1173,6 +1173,12 @@ namespace IfcGeom {
: -1.0
);
kernel.setValue(IfcGeom::Kernel::GV_BOOLEAN_ATTEMPT_2D,
settings.get(IteratorSettings::BOOLEAN_ATTEMPT_2D)
? +1.0
: -1.0
);
if (settings.get(IteratorSettings::BUILDING_LOCAL_PLACEMENT)) {
if (settings.get(IteratorSettings::SITE_LOCAL_PLACEMENT)) {
Logger::Message(Logger::LOG_WARNING, "building-local-placement takes precedence over site-local-placement");
+4 -2
View File
@@ -113,12 +113,14 @@ namespace IfcGeom
STRICT_TOLERANCE = 1 << 22,
/// Write boolean operands to file in current directory for debugging purposes
DEBUG_BOOLEAN = 1 << 23,
/// Try to perform boolean subtractions in 2d. Defaults to true.
BOOLEAN_ATTEMPT_2D = 1 << 24,
/// Number of different setting flags.
NUM_SETTINGS = 24,
NUM_SETTINGS = 25,
};
IteratorSettings()
: settings_(WELD_VERTICES) // OR options that default to true here
: settings_(WELD_VERTICES | BOOLEAN_ATTEMPT_2D) // OR options that default to true here
, deflection_tolerance_(1.e-3)
, angular_tolerance_(0.5)
{