mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-01 20:49:44 +00:00
Actualize trapezium profile per https://forums.buildingsmart.org/t/how-are-the-sides-of-ifctrapeziumprofiledefs-bounding-box-calculated-in-most-implementations/2945/8
This commit is contained in:
@@ -584,10 +584,14 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcRectangleHollowProfileDef* l,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IfcGeom::Kernel::convert(const IfcSchema::IfcTrapeziumProfileDef* l, TopoDS_Shape& face) {
|
bool IfcGeom::Kernel::convert(const IfcSchema::IfcTrapeziumProfileDef* l, TopoDS_Shape& face) {
|
||||||
const double x1 = l->BottomXDim() / 2.0f * getValue(GV_LENGTH_UNIT);
|
const double x1 = l->BottomXDim() / 2. * getValue(GV_LENGTH_UNIT);
|
||||||
const double w = l->TopXDim() * getValue(GV_LENGTH_UNIT);
|
const double w = l->TopXDim() * getValue(GV_LENGTH_UNIT);
|
||||||
const double dx = l->TopXOffset() * getValue(GV_LENGTH_UNIT);
|
const double dx = l->TopXOffset() * getValue(GV_LENGTH_UNIT);
|
||||||
const double y = l->YDim() / 2.0f * getValue(GV_LENGTH_UNIT);
|
const double y = l->YDim() / 2. * getValue(GV_LENGTH_UNIT);
|
||||||
|
|
||||||
|
// See: https://forums.buildingsmart.org/t/how-are-the-sides-of-ifctrapeziumprofiledefs-bounding-box-calculated-in-most-implementations/2945/8
|
||||||
|
// The trapezium x center should not be midway of BottomXDim but rather at the center of the overall bounding box.
|
||||||
|
const double x_offset = ((std::min(dx, 0.) + std::max(w + dx, x1 * 2.)) / 2.) - x1;
|
||||||
|
|
||||||
if ( x1 < ALMOST_ZERO || w < ALMOST_ZERO || y < ALMOST_ZERO ) {
|
if ( x1 < ALMOST_ZERO || w < ALMOST_ZERO || y < ALMOST_ZERO ) {
|
||||||
Logger::Message(Logger::LOG_NOTICE,"Skipping zero sized profile:",l);
|
Logger::Message(Logger::LOG_NOTICE,"Skipping zero sized profile:",l);
|
||||||
@@ -603,7 +607,12 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcTrapeziumProfileDef* l, TopoDS
|
|||||||
IfcGeom::Kernel::convert(l->Position(), trsf2d);
|
IfcGeom::Kernel::convert(l->Position(), trsf2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
double coords[8] = {-x1,-y, x1,-y, dx+w-x1,y, dx-x1,y};
|
double coords[8] = {
|
||||||
|
-x1 - x_offset, -y,
|
||||||
|
+x1 - x_offset, -y,
|
||||||
|
-x1 + dx + w - x_offset, y,
|
||||||
|
-x1 + dx - x_offset,y
|
||||||
|
};
|
||||||
return profile_helper(4,coords,0,0,0,trsf2d,face);
|
return profile_helper(4,coords,0,0,0,trsf2d,face);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user