mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Moves implementation of piecewise_function::evaluate(u) from h to cpp to prevent massive rebuilds everytime the function is changed.
This commit is contained in:
@@ -472,6 +472,16 @@ ifcopenshell::geometry::taxonomy::item::ptr ifcopenshell::geometry::taxonomy::pi
|
||||
return polygon_from_points(polygon);
|
||||
}
|
||||
|
||||
Eigen::Matrix4d ifcopenshell::geometry::taxonomy::piecewise_function::evaluate(double u) const {
|
||||
// @todo: rb optimize, assume monotonic evaluation and store last evaluated segment?
|
||||
for (auto& [length, fn] : spans) {
|
||||
if (u < length + 0.001) { // @todo: rb - need to use consistent tolerance
|
||||
return fn(u);
|
||||
}
|
||||
u -= length;
|
||||
}
|
||||
}
|
||||
|
||||
ifcopenshell::geometry::taxonomy::collection::ptr ifcopenshell::geometry::flatten(taxonomy::collection::ptr deep) {
|
||||
auto flat = make<taxonomy::collection>();
|
||||
ifcopenshell::geometry::visit<taxonomy::collection>(deep, [&flat](taxonomy::ptr i) {
|
||||
|
||||
@@ -151,15 +151,7 @@ typedef item const* ptr;
|
||||
|
||||
virtual item::ptr evaluate() const;
|
||||
|
||||
Eigen::Matrix4d evaluate(double u) const {
|
||||
// @todo: rb optimize, assume monotonic evaluation and store last evaluated segment?
|
||||
for (auto& [length, fn] : spans) {
|
||||
if (u < length+0.001) { // @todo: rb - need to use consistent tolerance
|
||||
return fn(u);
|
||||
}
|
||||
u -= length;
|
||||
}
|
||||
}
|
||||
Eigen::Matrix4d evaluate(double u) const;
|
||||
};
|
||||
|
||||
#ifdef TAXONOMY_USE_SHARED_PTR
|
||||
|
||||
Reference in New Issue
Block a user