mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 14:33:28 +00:00
Added '--strict-tolerance' option
This commit is contained in:
committed by
Thomas Krijnen
parent
10f4bca5d2
commit
4ea95960a2
@@ -225,6 +225,7 @@ private:
|
||||
double dimensionality;
|
||||
double layerset_first;
|
||||
double no_wire_intersection_check;
|
||||
double precision_factor;
|
||||
|
||||
// For stopping PlacementRelTo recursion in convert(const IfcSchema::IfcObjectPlacement* l, gp_Trsf& trsf)
|
||||
const IfcParse::declaration* placement_rel_to;
|
||||
@@ -258,6 +259,7 @@ public:
|
||||
, layerset_first(-1.)
|
||||
, disable_boolean_result(-1.)
|
||||
, no_wire_intersection_check(-1)
|
||||
, precision_factor(10.)
|
||||
{}
|
||||
|
||||
MAKE_TYPE_NAME(Kernel)(const MAKE_TYPE_NAME(Kernel)& other)
|
||||
|
||||
@@ -1418,6 +1418,9 @@ void IfcGeom::Kernel::setValue(GeomValue var, double value) {
|
||||
case GV_NO_WIRE_INTERSECTION_CHECK:
|
||||
no_wire_intersection_check = value;
|
||||
break;
|
||||
case GV_PRECISION_FACTOR:
|
||||
precision_factor = value;
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("Invalid setting");
|
||||
}
|
||||
@@ -1449,6 +1452,8 @@ double IfcGeom::Kernel::getValue(GeomValue var) const {
|
||||
return disable_boolean_result;
|
||||
case GV_NO_WIRE_INTERSECTION_CHECK:
|
||||
return no_wire_intersection_check;
|
||||
case GV_PRECISION_FACTOR:
|
||||
return precision_factor;
|
||||
}
|
||||
throw std::runtime_error("Invalid setting");
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace IfcGeom {
|
||||
|
||||
if (any_precision_encountered) {
|
||||
// Some arbitrary factor that has proven to work better for the models in the set of test files.
|
||||
lowest_precision_encountered *= 10.;
|
||||
lowest_precision_encountered *= kernel.getValue(IfcGeom::Kernel::GV_PRECISION_FACTOR);
|
||||
|
||||
lowest_precision_encountered *= unit_magnitude;
|
||||
if (lowest_precision_encountered < 1.e-7) {
|
||||
@@ -1008,6 +1008,11 @@ namespace IfcGeom {
|
||||
? +1.0
|
||||
: -1.0
|
||||
);
|
||||
kernel.setValue(IfcGeom::Kernel::GV_PRECISION_FACTOR,
|
||||
settings.get(IteratorSettings::STRICT_TOLERANCE)
|
||||
? 1.0
|
||||
: 10.0
|
||||
);
|
||||
|
||||
kernel.setValue(IfcGeom::Kernel::GV_DISABLE_BOOLEAN_RESULT,
|
||||
settings.get(IteratorSettings::DISABLE_BOOLEAN_RESULT)
|
||||
|
||||
@@ -96,9 +96,10 @@ namespace IfcGeom
|
||||
DISABLE_BOOLEAN_RESULT = 1 << 20,
|
||||
// Disables wire intersection checks
|
||||
NO_WIRE_INTERSECTION_CHECK = 1 << 21,
|
||||
|
||||
// Sets kernel precision factor to 1
|
||||
STRICT_TOLERANCE = 1 << 22,
|
||||
/// Number of different setting flags.
|
||||
NUM_SETTINGS = 21,
|
||||
NUM_SETTINGS = 22,
|
||||
};
|
||||
/// Used to store logical OR combination of setting flags.
|
||||
typedef unsigned SettingField;
|
||||
|
||||
Reference in New Issue
Block a user