Adds loop_to_piecewise_function_upgrade

This provides for a more uniform treatment of curves when mapping IfcOffsetCurveByDistances and IfcPointByDistanceExpression
This commit is contained in:
Richard Brice
2024-01-11 15:37:44 -08:00
parent 5815417198
commit a8b88b8ae1
4 changed files with 117 additions and 27 deletions
+3 -5
View File
@@ -455,9 +455,7 @@ ifcopenshell::geometry::taxonomy::solid::ptr ifcopenshell::geometry::create_box(
ifcopenshell::geometry::taxonomy::item::ptr ifcopenshell::geometry::taxonomy::piecewise_function::evaluate() const {
// @todo configure resolution
double length = 0.0;
for (auto& s : spans)
length += s.first;
double curve_length = length();
std::vector<taxonomy::point3::ptr> polygon;
@@ -466,12 +464,12 @@ ifcopenshell::geometry::taxonomy::item::ptr ifcopenshell::geometry::taxonomy::pi
int num_steps = 0;
if (param_type == ifcopenshell::geometry::settings::PiecewiseStepMethod::MAXSTEPSIZE) {
// parameter is max step size
num_steps = (int)std::ceil(length / param);
num_steps = (int)std::ceil(curve_length / param);
} else {
// parameter is minimum number of steps
num_steps = (int)std::ceil(param);
}
auto resolution = length / num_steps;
auto resolution = curve_length / num_steps;
for (int i = 0; i <= num_steps; ++i) {
auto u = resolution * i;