diff --git a/src/MissionManager/CorridorScanComplexItem.cc b/src/MissionManager/CorridorScanComplexItem.cc index 13d7f7659a37..3c019aa10df9 100644 --- a/src/MissionManager/CorridorScanComplexItem.cc +++ b/src/MissionManager/CorridorScanComplexItem.cc @@ -394,11 +394,11 @@ double CorridorScanComplexItem::timeBetweenShots(void) double CorridorScanComplexItem::_calcTransectSpacing(void) const { double transectSpacing = _cameraCalc.adjustedFootprintSide()->rawValue().toDouble(); - if (transectSpacing < 0.5) { + if (transectSpacing < _minimumTransectSpacingMeters) { // We can't let spacing get too small otherwise we will end up with too many transects. - // So we limit to 0.5 meter spacing as min and set to huge value which will cause a single - // transect to be added. - transectSpacing = 100000; + // So we limit the spacing to be above a small increment and below that value we set to huge spacing + // which will cause a single transect to be added instead of having things blow up. + transectSpacing = _forceLargeTransectSpacingMeters; } return transectSpacing; diff --git a/src/MissionManager/SurveyComplexItem.cc b/src/MissionManager/SurveyComplexItem.cc index ca113b69e102..f562bdd8d791 100644 --- a/src/MissionManager/SurveyComplexItem.cc +++ b/src/MissionManager/SurveyComplexItem.cc @@ -674,11 +674,11 @@ void SurveyComplexItem::_rebuildTransectsPhase1WorkerSinglePolygon(bool refly) double gridAngle = _gridAngleFact.rawValue().toDouble(); double gridSpacing = _cameraCalc.adjustedFootprintSide()->rawValue().toDouble(); - if (gridSpacing < 0.5) { - // We can't let gridSpacing get too small otherwise we will end up with too many transects. - // So we limit to 0.5 meter spacing as min and set to huge value which will cause a single - // transect to be added. - gridSpacing = 100000; + if (gridSpacing < _minimumTransectSpacingMeters) { + // We can't let spacing get too small otherwise we will end up with too many transects. + // So we limit the spacing to be above a small increment and below that value we set to huge spacing + // which will cause a single transect to be added instead of having things blow up. + gridSpacing = _forceLargeTransectSpacingMeters; } gridAngle = _clampGridAngle90(gridAngle); diff --git a/src/MissionManager/TransectStyleComplexItem.h b/src/MissionManager/TransectStyleComplexItem.h index ede0c2905541..10292b8b71fa 100644 --- a/src/MissionManager/TransectStyleComplexItem.h +++ b/src/MissionManager/TransectStyleComplexItem.h @@ -211,6 +211,8 @@ protected slots: static constexpr int _terrainQueryTimeoutMsecs= 1000; static constexpr int _hoverAndCaptureDelaySeconds = 4; + static constexpr double _minimumTransectSpacingMeters = 0.3; + static constexpr double _forceLargeTransectSpacingMeters = 100000; private slots: void _reallyQueryTransectsPathHeightInfo (void); @@ -245,5 +247,5 @@ private slots: QTimer _terrainPolyPathQueryTimer; // Deprecated json keys - static constexpr const char* _jsonTerrainFollowKeyDeprecated = "FollowTerrain"; + static constexpr const char* _jsonTerrainFollowKeyDeprecated = "FollowTerrain"; };