mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 21:53:40 +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:
committed by
Thomas Krijnen
parent
f448339fce
commit
cef3de4e57
@@ -472,6 +472,16 @@ ifcopenshell::geometry::taxonomy::item::ptr ifcopenshell::geometry::taxonomy::pi
|
|||||||
return polygon_from_points(polygon);
|
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) {
|
ifcopenshell::geometry::taxonomy::collection::ptr ifcopenshell::geometry::flatten(taxonomy::collection::ptr deep) {
|
||||||
auto flat = make<taxonomy::collection>();
|
auto flat = make<taxonomy::collection>();
|
||||||
ifcopenshell::geometry::visit<taxonomy::collection>(deep, [&flat](taxonomy::ptr i) {
|
ifcopenshell::geometry::visit<taxonomy::collection>(deep, [&flat](taxonomy::ptr i) {
|
||||||
|
|||||||
@@ -151,15 +151,7 @@ typedef item const* ptr;
|
|||||||
|
|
||||||
virtual item::ptr evaluate() const;
|
virtual item::ptr evaluate() const;
|
||||||
|
|
||||||
Eigen::Matrix4d evaluate(double u) 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef TAXONOMY_USE_SHARED_PTR
|
#ifdef TAXONOMY_USE_SHARED_PTR
|
||||||
|
|||||||
Reference in New Issue
Block a user