diff --git a/src/Wima/Circle.cc b/src/Wima/Circle.cc index a5db23af5770b928cfb8785a7ae37a7557cd3827..b12319ab2806a8d5ef72ce7bf7b1771e54a33837 100644 --- a/src/Wima/Circle.cc +++ b/src/Wima/Circle.cc @@ -107,7 +107,7 @@ QList Circle::approximate(double angleDiscretisation) const QList Circle::approximateSektor(int numberOfCorners, double alpha1, double alpha2) const { - if ( numberOfCorners < 3) + if ( numberOfCorners < 2) return QList(); return approximateSektor((alpha2-alpha1)/double(numberOfCorners-1), alpha1, alpha2); } diff --git a/src/Wima/CircularSurveyComplexItem.cc b/src/Wima/CircularSurveyComplexItem.cc index dc17bc20005465e0bc11a06645bb39b93e13947c..2f6509d3719e4809b623ba409f3720ea2424943a 100644 --- a/src/Wima/CircularSurveyComplexItem.cc +++ b/src/Wima/CircularSurveyComplexItem.cc @@ -481,15 +481,18 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1() for (int k = 0; k < entryPoints.size(); k++) { double alpha1 = angle(entryPoints[k]); double alpha2 = angle(exitPoints[(k+offset) % entryPoints.size()]); + double dAlpha = alpha2-alpha1; + int numNodes = int(ceil(dAlpha/dalpha)) + 1; - QList sectorPath = circle.approximateSektor(double(dalpha), alpha1, alpha2); + QList sectorPath = circle.approximateSektor(numNodes, alpha1, alpha2); // use shortestPath() here if necessary, could be a problem if dr >> if (sectorPath.size() > 0) transectPath.append(sectorPath); } } else if (originInside) { - // circle fully inside polygon - QList sectorPath = circle.approximateSektor(double(dalpha), 0, 2*M_PI); + // circle fully inside polygon + int numNodes = int(ceil(2*M_PI/dalpha)) + 1; + QList sectorPath = circle.approximateSektor(numNodes, 0, 2*M_PI); // use shortestPath() here if necessary, could be a problem if dr >> transectPath.append(sectorPath); }