Save positions with 4 digits and rotations with 6.

This commit is contained in:
leozide 2017-07-26 17:34:25 -07:00
parent 6c23edf064
commit 5de0644c7b
4 changed files with 6 additions and 6 deletions

View file

@ -385,7 +385,7 @@ void lcModel::SaveLDraw(QTextStream& Stream, bool SelectedOnly) const
float Numbers[13] = { FloatMatrix[12], -FloatMatrix[14], FloatMatrix[13], FloatMatrix[0], -FloatMatrix[8], FloatMatrix[4], -FloatMatrix[2], FloatMatrix[10], -FloatMatrix[6], FloatMatrix[1], -FloatMatrix[9], FloatMatrix[5], ControlPoint.Scale };
for (int NumberIdx = 0; NumberIdx < 13; NumberIdx++)
Stream << ' ' << lcFormatValue(Numbers[NumberIdx]);
Stream << ' ' << lcFormatValue(Numbers[NumberIdx], NumberIdx < 3 ? 4 : 6);
Stream << LineEnding;
}

View file

@ -118,7 +118,7 @@ void lcPiece::SaveLDraw(QTextStream& Stream) const
Stream << QLatin1String("0 !LEOCAD PIECE PIVOT ");
for (int NumberIdx = 0; NumberIdx < 12; NumberIdx++)
Stream << ' ' << lcFormatValue(PivotNumbers[NumberIdx]);
Stream << ' ' << lcFormatValue(PivotNumbers[NumberIdx], NumberIdx < 3 ? 4 : 6);
Stream << LineEnding;
}
@ -135,7 +135,7 @@ void lcPiece::SaveLDraw(QTextStream& Stream) const
float Numbers[12] = { Matrix[12], -Matrix[14], Matrix[13], Matrix[0], -Matrix[8], Matrix[4], -Matrix[2], Matrix[10], -Matrix[6], Matrix[1], -Matrix[9], Matrix[5] };
for (int NumberIdx = 0; NumberIdx < 12; NumberIdx++)
Stream << lcFormatValue(Numbers[NumberIdx]) << ' ';
Stream << lcFormatValue(Numbers[NumberIdx], NumberIdx < 3 ? 4 : 6) << ' ';
Stream << mID << LineEnding;
}

View file

@ -4,9 +4,9 @@
#include "lc_library.h"
#include "pieceinf.h"
QString lcFormatValue(float Value)
QString lcFormatValue(float Value, int Precision)
{
QString String = QString::number(Value, 'f', 4);
QString String = QString::number(Value, 'f', Precision);
int Dot = String.indexOf('.');
if (Dot != -1)

View file

@ -2,7 +2,7 @@
#include <QObject>
QString lcFormatValue(float Value);
QString lcFormatValue(float Value, int Precision);
QString lcFormatValueLocalized(float Value);
float lcParseValueLocalized(const QString& Value);