mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 14:31:39 +00:00
Improvements for precision handling
This commit is contained in:
@@ -592,6 +592,9 @@ double UnitPrefixToValue( Ifc2x3::IfcSIPrefix::IfcSIPrefix v ) {
|
|||||||
else return 1.0f;
|
else return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string unit_name = "METER";
|
||||||
|
static float unit_magnitude = 1.0f;
|
||||||
|
|
||||||
void IfcGeomObjects::InitPrecision() {
|
void IfcGeomObjects::InitPrecision() {
|
||||||
IfcGeom::SetValue(IfcGeom::GV_PRECISION, 0.00001);
|
IfcGeom::SetValue(IfcGeom::GV_PRECISION, 0.00001);
|
||||||
|
|
||||||
@@ -617,7 +620,16 @@ void IfcGeomObjects::InitPrecision() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (any_precision_encountered) {
|
if (any_precision_encountered) {
|
||||||
IfcGeom::SetValue(IfcGeom::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");
|
||||||
|
IfcGeom::SetValue(IfcGeom::GV_PRECISION, 1.e-7);
|
||||||
|
} else {
|
||||||
|
IfcGeom::SetValue(IfcGeom::GV_PRECISION, lowest_precision_encountered);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (const IfcParse::IfcException& ex) {
|
} catch (const IfcParse::IfcException& ex) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@@ -626,9 +638,6 @@ void IfcGeomObjects::InitPrecision() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string unit_name = "METER";
|
|
||||||
static float unit_magnitude = 1.0f;
|
|
||||||
|
|
||||||
void IfcGeomObjects::InitUnits() {
|
void IfcGeomObjects::InitUnits() {
|
||||||
// Set default units, set length to meters, angles to undefined
|
// Set default units, set length to meters, angles to undefined
|
||||||
IfcGeom::SetValue(IfcGeom::GV_LENGTH_UNIT,1.0);
|
IfcGeom::SetValue(IfcGeom::GV_LENGTH_UNIT,1.0);
|
||||||
|
|||||||
Reference in New Issue
Block a user