From 4cd327f711737253d5f979d0b15fa80c3c69872d Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 5 Dec 2023 21:11:36 +0100 Subject: [PATCH] Don't mutate conversion result placement. Breaks combination of world coords + optimized model. --- src/ifcgeom/ConversionResult.cpp | 10 ++++++++++ src/ifcgeom/ConversionResult.h | 10 ++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/ifcgeom/ConversionResult.cpp b/src/ifcgeom/ConversionResult.cpp index da29dc380e..30bed11214 100644 --- a/src/ifcgeom/ConversionResult.cpp +++ b/src/ifcgeom/ConversionResult.cpp @@ -8,3 +8,13 @@ IfcGeom::Representation::Triangulation * IfcGeom::ConversionResultShape::Triangu Triangulate(settings, iden, t, -1); return t; } + +using namespace ifcopenshell::geometry::taxonomy; + +void IfcGeom::ConversionResult::append(ifcopenshell::geometry::taxonomy::matrix4::ptr trsf) { + placement_ = make(placement_->ccomponents() * trsf->ccomponents()); +} + +void IfcGeom::ConversionResult::prepend(ifcopenshell::geometry::taxonomy::matrix4::ptr trsf) { + placement_ = make(trsf->ccomponents() * placement_->ccomponents()); +} diff --git a/src/ifcgeom/ConversionResult.h b/src/ifcgeom/ConversionResult.h index 333b305ec4..1577eb369d 100644 --- a/src/ifcgeom/ConversionResult.h +++ b/src/ifcgeom/ConversionResult.h @@ -245,14 +245,8 @@ namespace IfcGeom { ConversionResult(int id, ConversionResultShape* shape) : id(id), placement_(ifcopenshell::geometry::taxonomy::make()), shape_(shape) {} - void append(ifcopenshell::geometry::taxonomy::matrix4::ptr trsf) { - // @todo verify order - placement_->components() = placement_->ccomponents() * trsf->ccomponents(); - } - void prepend(ifcopenshell::geometry::taxonomy::matrix4::ptr trsf) { - // @todo verify order - placement_->components() = trsf->ccomponents() * placement_->ccomponents(); - } + void append(ifcopenshell::geometry::taxonomy::matrix4::ptr trsf); + void prepend(ifcopenshell::geometry::taxonomy::matrix4::ptr trsf); std::shared_ptr Shape() const { return shape_; } ifcopenshell::geometry::taxonomy::matrix4::ptr Placement() const { return placement_; } bool hasStyle() const { return !!style_; }