Skip to content

Commit

Permalink
Handle small step factor in log plot for #345
Browse files Browse the repository at this point in the history
  • Loading branch information
markummitchell-tu committed Jul 26, 2019
1 parent bed09aa commit 7d0aedb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/Dlg/DlgSettingsExportFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,12 @@ void DlgSettingsExportFormat::updateIntervalConstraints ()
m_minIntervalGraph :
m_minIntervalScreen);

if (cmdMediator().document().modelCoords().coordScaleYRadius() == COORD_SCALE_LOG) {
// Override scale factor with log scale so Export classes are assured that multiplying by the scale factor will
// cause an increase
functionsMin = qMax (1.00000001, functionsMin);
}

if (m_tabWidget->currentIndex() == TAB_WIDGET_INDEX_FUNCTIONS) {

if (m_modelExportAfter->pointsIntervalFunctions() < functionsMin) {
Expand Down
16 changes: 10 additions & 6 deletions src/Export/ExportXThetaValuesMergedFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,21 @@ ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLogGraph (double xTh
// Convert the gathered values into a periodic sequence
ValuesVectorXOrY values;
double xTheta = xThetaFirstSimplestNumber;
while (xTheta > xThetaMin) {
xTheta /= m_modelExport.pointsIntervalFunctions(); // Go backwards until reaching or passing minimum
if (m_modelExport.pointsIntervalFunctions() > 1) { // Safe to iterate
while (xTheta > xThetaMin) {
xTheta /= m_modelExport.pointsIntervalFunctions(); // Go backwards until reaching or passing minimum
}
}
if (xTheta < xThetaMin) {
values [xThetaMin] = true; // We passed minimum so insert point right at xThetaMin
}

xTheta *= m_modelExport.pointsIntervalFunctions();
while (xTheta <= xThetaMax) {
values [xTheta] = true;
xTheta *= m_modelExport.pointsIntervalFunctions(); // Insert point at a simple number
if (m_modelExport.pointsIntervalFunctions() > 1) { // Safe to iterate
xTheta *= m_modelExport.pointsIntervalFunctions();
while (xTheta <= xThetaMax) {
values [xTheta] = true;
xTheta *= m_modelExport.pointsIntervalFunctions(); // Insert point at a simple number
}
}

if (xTheta > xThetaMax) {
Expand Down

0 comments on commit 7d0aedb

Please sign in to comment.