From 65d5df7801678158eee63193c2e529f32343ea63 Mon Sep 17 00:00:00 2001 From: Richard Brice <37087370+RickBrice@users.noreply.github.com> Date: Sun, 15 Feb 2026 11:15:04 -0800 Subject: [PATCH] IfcAxis2PlacementLinear mapping used with IfcSectionedSurface and IfcSectionedSolidHorizontal IfcSectionedSurface and IfcSectionedSolidHorizontal both of CrossSectionPositions attributes which are lists of IfcAxis2PlacementLinear. The implementation of each class used its own bespoke mapping of IfcAxis2PlacementLinear, which were identical to each other and slightly different than IfcAxis2PlacementLinear. Now the two sectioned classes use the one and only mapping for IfcAxis2PlacementLinear --- .../mapping/IfcSectionedSolidHorizontal.cpp | 30 ++--------------- src/ifcgeom/mapping/IfcSectionedSurface.cpp | 33 +++---------------- 2 files changed, 7 insertions(+), 56 deletions(-) diff --git a/src/ifcgeom/mapping/IfcSectionedSolidHorizontal.cpp b/src/ifcgeom/mapping/IfcSectionedSolidHorizontal.cpp index a2bc648f08..ad1e2e0d4c 100644 --- a/src/ifcgeom/mapping/IfcSectionedSolidHorizontal.cpp +++ b/src/ifcgeom/mapping/IfcSectionedSolidHorizontal.cpp @@ -61,33 +61,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal* in longitudes.push_back(*pbde->DistanceAlong()->as(true) * length_unit_); - // Corresponds to the profile X, Y directions (hopefully). - Eigen::Vector3d po( - pbde->OffsetLateral().get_value_or(0.), - // @todo I don't understand whether vertical is an offset relative to the tangent plane or to the global XY plane - pbde->OffsetVertical().get_value_or(0.), - 0. - ); - - profile_offsets.push_back(po); - - boost::optional rot; - if (csp->Axis() && csp->RefDirection()) { - rot = taxonomy::matrix4( - Eigen::Vector3d(0, 0, 0), - taxonomy::cast(map(csp->Axis()))->ccomponents(), - taxonomy::cast(map(csp->RefDirection()))->ccomponents()).ccomponents().block<3,3>(0,0); - } else if (csp->Axis()) { - rot = taxonomy::matrix4( - Eigen::Vector3d(0, 0, 0), - taxonomy::cast(map(csp->Axis()))->ccomponents()).ccomponents().block<3, 3>(0, 0); - } else if (csp->RefDirection()) { - rot = taxonomy::matrix4( - Eigen::Vector3d(0, 0, 0), - Eigen::Vector3d(0, 0, 1), - taxonomy::cast(map(csp->RefDirection()))->ccomponents() - ).ccomponents().block<3, 3>(0, 0); - } + auto linear_placement = taxonomy::cast(map(csp)); + profile_offsets.push_back(linear_placement->ccomponents().block<3, 1>(0, 3)); + boost::optional rot(linear_placement->ccomponents().block<3,3>(0,0)); profile_rotations.push_back(rot); } if (faces.size() != profile_offsets.size()) { diff --git a/src/ifcgeom/mapping/IfcSectionedSurface.cpp b/src/ifcgeom/mapping/IfcSectionedSurface.cpp index 49fde15759..b91b7b62c2 100644 --- a/src/ifcgeom/mapping/IfcSectionedSurface.cpp +++ b/src/ifcgeom/mapping/IfcSectionedSurface.cpp @@ -63,35 +63,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface* inst) { longitudes.push_back(*pbde->DistanceAlong()->as(true) * length_unit_); - // Corresponds to the profile X, Y directions (hopefully). - Eigen::Vector3d po( - pbde->OffsetLateral().get_value_or(0.), - // @todo I don't understand whether vertical is an offset relative to the tangent plane or to the global XY plane - pbde->OffsetVertical().get_value_or(0.), - 0. - ); - - profile_offsets.push_back(po); - - boost::optional rot; - if (csp->Axis() && csp->RefDirection()) { - rot = taxonomy::matrix4( - Eigen::Vector3d(0, 0, 0), - taxonomy::cast(map(csp->Axis()))->ccomponents(), - taxonomy::cast(map(csp->RefDirection()))->ccomponents()).ccomponents().block<3, 3>(0, 0); - } else if (csp->Axis()) { - rot = taxonomy::matrix4( - Eigen::Vector3d(0, 0, 0), - taxonomy::cast(map(csp->Axis()))->ccomponents()).ccomponents().block<3, 3>(0, 0); - } else if (csp->RefDirection()) { - rot = taxonomy::matrix4( - Eigen::Vector3d(0, 0, 0), - Eigen::Vector3d(0, 0, 1), - taxonomy::cast(map(csp->RefDirection()))->ccomponents()) - .ccomponents() - .block<3, 3>(0, 0); - } - profile_rotations.push_back(rot); + auto linear_placement = taxonomy::cast(map(csp)); + profile_offsets.push_back(linear_placement->ccomponents().block<3, 1>(0, 3)); + boost::optional rot(linear_placement->ccomponents().block<3, 3>(0, 0)); + profile_rotations.push_back(rot); } #else return nullptr;