Fix 2 segfaults creating IfcEllipseProfileDef

1) taxonomy::ellipse was missing matrix so create_shape was segfaulting either was if Position was set or was not (segfaulting on line - https://github.com/IfcOpenShell/IfcOpenShell/blob/5616367a03ea397885e93523e55788da82238742/src/ifcgeom/kernels/opencascade/loop.cpp#L92)
2) was segfaulting when there was no default matrix

Removed fc->matrix assignment as matrix is already assigned to the curve.
This commit is contained in:
Andrej730
2024-09-10 17:33:47 +05:00
parent 6fd4d8b1ba
commit 34aed93b7b
+4 -1
View File
@@ -39,6 +39,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipseProfileDef* inst) {
#endif
if (has_position) {
m4 = taxonomy::cast<taxonomy::matrix4>(map(inst->Position()));
} else {
// matrix needs to be set on elementary curves.
m4 = taxonomy::make<taxonomy::matrix4>();
}
if (ry > rx) {
@@ -58,9 +61,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipseProfileDef* inst) {
auto el = taxonomy::make<taxonomy::ellipse>();
el->radius = rx;
el->radius2 = ry;
el->matrix = m4;
ed->basis = el;
lp->children.push_back(ed);
fc->children.push_back(lp);
fc->matrix = m4;
return fc;
}