mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 22:31:55 +00:00
Improvements for precision handling
This commit is contained in:
@@ -183,7 +183,16 @@ namespace IfcGeom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (any_precision_encountered) {
|
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 {
|
} else {
|
||||||
kernel.setValue(IfcGeom::Kernel::GV_PRECISION, 1.e-5);
|
kernel.setValue(IfcGeom::Kernel::GV_PRECISION, 1.e-5);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,12 +242,16 @@
|
|||||||
context = subcontext->ParentContext();
|
context = subcontext->ParentContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
double precision = 1.e-5;
|
double precision = 1.e-6;
|
||||||
if (context->hasPrecision()) {
|
if (context->hasPrecision()) {
|
||||||
precision = context->Precision();
|
precision = context->Precision();
|
||||||
}
|
}
|
||||||
std::pair<std::string, double> length_unit = kernel.initializeUnits(project->UnitsInContext());
|
std::pair<std::string, double> length_unit = kernel.initializeUnits(project->UnitsInContext());
|
||||||
precision *= length_unit.second;
|
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);
|
kernel.setValue(IfcGeom::Kernel::GV_PRECISION, precision);
|
||||||
|
|
||||||
IfcGeom::BRepElement<double>* brep = kernel.create_brep_for_representation_and_product<double>(settings, representation, product);
|
IfcGeom::BRepElement<double>* brep = kernel.create_brep_for_representation_and_product<double>(settings, representation, product);
|
||||||
|
|||||||
Reference in New Issue
Block a user