mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-28 07:49:59 +00:00
b82c4c53fe
The profile mapping builds its points as
profile_helper(m4, {
{{-x, -y}, {f2}},
...
where `f2` is a `double` and profile_point's second member is a
`boost::optional<double>`. In recent Boost (somewhere between 1.85 and 1.91)
optional's converting constructor became explicit, and an explicit constructor
cannot be used in copy-initialization — which is what a braced element is. So
every one of these call sites stops compiling:
MSVC 19.4x: error C2664: cannot convert argument 2 from
'initializer list' to 'const std::vector<profile_point>&'
clang-cl 22: error: chosen constructor is explicit in copy-initialization
Twelve translation units are affected (IfcCShapeProfileDef,
IfcIShapeProfileDef, IfcLShapeProfileDef, IfcTShapeProfileDef,
IfcUShapeProfileDef, IfcZShapeProfileDef, IfcAsymmetricIShapeProfileDef,
IfcCraneRailAShapeProfileDef, IfcRectangleProfileDef,
IfcRectangleHollowProfileDef, IfcRoundedRectangleProfileDef,
IfcTrapeziumProfileDef), roughly 100 call sites in total.
Adding one overload that takes the double directly fixes all of them without
touching a single call site, and changes nothing for existing code: the
optional overload still wins wherever an optional is passed.
Verified by building schemas 2x3;4;4x3_add2 with MSVC 2022 against Boost
1.91 and OCCT 7.9.3 — IfcParse, IfcGeom, the schema mappings and
geometry_kernel_opencascade all archive cleanly. Without this, the same build
against Boost 1.85 succeeds, which is what identified Boost as the variable.
49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
#ifndef PROFILE_HELPER_H
|
|
#define PROFILE_HELPER_H
|
|
|
|
#include "taxonomy.h"
|
|
|
|
namespace ifcopenshell {
|
|
|
|
namespace geometry {
|
|
struct profile_point {
|
|
std::array<double, 2> xy;
|
|
boost::optional<double> radius;
|
|
|
|
profile_point(const std::array<double, 2>& p, const boost::optional<double>& r = boost::none)
|
|
: xy(p), radius(r) {
|
|
}
|
|
|
|
// Recent Boost makes optional's converting constructor explicit,
|
|
// and an explicit constructor cannot be used in copy-initialization
|
|
// - which is what `{{x, y}, {radius}}` in the profile mappings is.
|
|
// Taking the double directly keeps every call site working.
|
|
profile_point(const std::array<double, 2>& p, double r)
|
|
: xy(p), radius(r) {
|
|
}
|
|
};
|
|
|
|
struct profile_point_with_edges {
|
|
Eigen::Vector2d xy;
|
|
boost::optional<double> radius;
|
|
taxonomy::edge::ptr previous, next;
|
|
};
|
|
|
|
struct profile_point_with_edges_3d {
|
|
Eigen::Vector3d xy;
|
|
boost::optional<double> radius;
|
|
taxonomy::edge::ptr previous, next;
|
|
};
|
|
|
|
taxonomy::loop::ptr polygon_from_points(const std::vector<taxonomy::point3::ptr>& ps, bool external = true);
|
|
|
|
taxonomy::loop::ptr profile_helper(const taxonomy::matrix4::ptr& m4, const std::vector<profile_point>& points);
|
|
|
|
taxonomy::loop::ptr fillet_loop(taxonomy::loop::ptr lp, double radius);
|
|
|
|
void remove_duplicate_points_from_loop(std::vector<taxonomy::point3::ptr>& polygon, bool closed, double tol);
|
|
}
|
|
|
|
}
|
|
|
|
#endif |