Improvements for precision handling

This commit is contained in:
Thomas Krijnen
2015-01-06 14:09:28 +00:00
parent 1c757c351b
commit 9780c047e9
2 changed files with 15 additions and 2 deletions
+10 -1
View File
@@ -183,7 +183,16 @@ namespace IfcGeom {
}
if (any_precision_encountered) {
kernel.setValue(IfcGeom::Kernel::GV_PRECISION, lowest_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 *= unit_magnitude;
if (lowest_precision_encountered < 1.e-7) {
Logger::Message(Logger::LOG_WARNING, "Precision lower than 0.0000001 meter not enforced");
kernel.setValue(IfcGeom::Kernel::GV_PRECISION, 1.e-7);
} else {
kernel.setValue(IfcGeom::Kernel::GV_PRECISION, lowest_precision_encountered);
}
} else {
kernel.setValue(IfcGeom::Kernel::GV_PRECISION, 1.e-5);
}
+5 -1
View File
@@ -242,12 +242,16 @@
context = subcontext->ParentContext();
}
double precision = 1.e-5;
double precision = 1.e-6;
if (context->hasPrecision()) {
precision = context->Precision();
}
std::pair<std::string, double> length_unit = kernel.initializeUnits(project->UnitsInContext());
precision *= length_unit.second;
// Some arbitrary factor that has proven to work better for the models in the set of test files.
precision *= 10.;
kernel.setValue(IfcGeom::Kernel::GV_PRECISION, precision);
IfcGeom::BRepElement<double>* brep = kernel.create_brep_for_representation_and_product<double>(settings, representation, product);