diff --git a/src/ifcgeom/mapping/IfcCurveSegment.cpp b/src/ifcgeom/mapping/IfcCurveSegment.cpp index cd92d229bb..727032895d 100644 --- a/src/ifcgeom/mapping/IfcCurveSegment.cpp +++ b/src/ifcgeom/mapping/IfcCurveSegment.cpp @@ -40,11 +40,11 @@ namespace double integrate(double a, double b, unsigned n, std::function fn) { double area = 0; - double h = (b - a) / (n + 1); - for (auto i = 0; i < n; i++) + double h = (b - a) / n; + for (auto i = 1; i <= n; i++) { - auto x1 = a + h * i; - auto x2 = a + h * (i + 1); + auto x1 = a + h * (i - 1); + auto x2 = a + h * i; auto f1 = fn(x1); auto f2 = fn(x2); area += h * (f1 + f2) / 2.0;