From 91e5b337d371c2f1bbf31f7ce5907b6b5f4c4b5b Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 5 Apr 2017 16:06:07 +0200 Subject: [PATCH] Reverse matrix multiplication order --- src/ifcgeom/kernels/cgal/CgalIfcGeomPrimitives.cpp | 2 +- src/ifcgeom/kernels/cgal/CgalKernel.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ifcgeom/kernels/cgal/CgalIfcGeomPrimitives.cpp b/src/ifcgeom/kernels/cgal/CgalIfcGeomPrimitives.cpp index 62c155b5ba..34f5b6c10c 100644 --- a/src/ifcgeom/kernels/cgal/CgalIfcGeomPrimitives.cpp +++ b/src/ifcgeom/kernels/cgal/CgalIfcGeomPrimitives.cpp @@ -192,7 +192,7 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcObjectPlacement* l, cgal_p // } std::cout << std::endl; // } - trsf = trsf * trsf2; // TODO: I think it's fine, but maybe should it be the other way around? + trsf = trsf2 * trsf; // std::cout << "trsf (after multiplication)" << std::endl; // for (int i = 0; i < 3; ++i) { diff --git a/src/ifcgeom/kernels/cgal/CgalKernel.cpp b/src/ifcgeom/kernels/cgal/CgalKernel.cpp index 2e69487603..9c9512ceac 100644 --- a/src/ifcgeom/kernels/cgal/CgalKernel.cpp +++ b/src/ifcgeom/kernels/cgal/CgalKernel.cpp @@ -225,7 +225,7 @@ bool IfcGeom::CgalKernel::convert_openings(const IfcSchema::IfcProduct* entity, // } // Move the opening into the coordinate system of the IfcProduct - opening_trsf = opening_trsf * entity_trsf.inverse(); + opening_trsf = entity_trsf.inverse() * opening_trsf; // std::cout << "opening_trsf after" << std::endl; // for (int i = 0; i < 3; ++i) { @@ -248,7 +248,7 @@ bool IfcGeom::CgalKernel::convert_openings(const IfcSchema::IfcProduct* entity, if (opening_shapes[i].Placement()) { gtrsf = *(CgalPlacement*)opening_shapes[i].Placement(); } - gtrsf = gtrsf * opening_trsf; + gtrsf = opening_trsf * gtrsf; cgal_shape_t opening_shape(((CgalShape*)opening_shapes[i].Shape())->shape()); for (auto &vertex: vertices(opening_shape)) vertex->point() = vertex->point().transform(gtrsf); opening_shapelist.push_back(opening_shape);