New math parser function "r2cm". Round to up to 1 decimal.
--HG-- branch : develop
This commit is contained in:
parent
be614ad9f8
commit
0adfbb8fb1
|
@ -22,6 +22,7 @@
|
|||
- [#756] New feature. Select pieces from command line.
|
||||
- [#761] New feature. Export final measurements.
|
||||
- [#758] Intersection Passmark - select which side is shown.
|
||||
- New math parser function "r2cm". Round to up to 1 decimal.
|
||||
|
||||
# Version 0.5.1
|
||||
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
||||
|
|
|
@ -170,6 +170,12 @@ qreal QmuParser::Rint(qreal v)
|
|||
return qFloor(v + 0.5);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal QmuParser::R2CM(qreal v)
|
||||
{
|
||||
return Rint(v*10.0)/10.0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal QmuParser::Sign(qreal v)
|
||||
{
|
||||
|
@ -365,6 +371,7 @@ void QmuParser::InitFun()
|
|||
DefineFun("sqrt", qSqrt);
|
||||
DefineFun("sign", Sign);
|
||||
DefineFun("rint", Rint);
|
||||
DefineFun("r2cm", R2CM);
|
||||
DefineFun("abs", Abs);
|
||||
DefineFun("fmod", FMod);
|
||||
// Functions with variable number of arguments
|
||||
|
|
|
@ -84,6 +84,7 @@ namespace qmu
|
|||
// misc
|
||||
static qreal Abs(qreal);
|
||||
static qreal Rint(qreal);
|
||||
static qreal R2CM(qreal);
|
||||
static qreal Sign(qreal);
|
||||
static qreal FMod(qreal, qreal);
|
||||
// Prefix operators
|
||||
|
|
|
@ -85,6 +85,7 @@ const QString exp_F = QStringLiteral("exp");
|
|||
const QString sqrt_F = QStringLiteral("sqrt");
|
||||
const QString sign_F = QStringLiteral("sign");
|
||||
const QString rint_F = QStringLiteral("rint");
|
||||
const QString r2cm_F = QStringLiteral("r2cm");
|
||||
const QString abs_F = QStringLiteral("abs");
|
||||
const QString min_F = QStringLiteral("min");
|
||||
const QString max_F = QStringLiteral("max");
|
||||
|
@ -92,13 +93,41 @@ const QString sum_F = QStringLiteral("sum");
|
|||
const QString avg_F = QStringLiteral("avg");
|
||||
const QString fmod_F = QStringLiteral("fmod");
|
||||
|
||||
const QStringList builInFunctions = QStringList() << degTorad_F << radTodeg_F
|
||||
<< sin_F << cos_F << tan_F << asin_F << acos_F << atan_F
|
||||
<< sinh_F << cosh_F << tanh_F << asinh_F << acosh_F << atanh_F
|
||||
<< sinD_F << cosD_F << tanD_F << asinD_F << acosD_F << atanD_F
|
||||
<< log2_F << log10_F << log_F << ln_F << exp_F << sqrt_F
|
||||
<< sign_F << rint_F << abs_F << min_F << max_F << sum_F
|
||||
<< avg_F << fmod_F;
|
||||
const QStringList builInFunctions = QStringList() << degTorad_F
|
||||
<< radTodeg_F
|
||||
<< sin_F
|
||||
<< cos_F
|
||||
<< tan_F
|
||||
<< asin_F
|
||||
<< acos_F
|
||||
<< atan_F
|
||||
<< sinh_F
|
||||
<< cosh_F
|
||||
<< tanh_F
|
||||
<< asinh_F
|
||||
<< acosh_F
|
||||
<< atanh_F
|
||||
<< sinD_F
|
||||
<< cosD_F
|
||||
<< tanD_F
|
||||
<< asinD_F
|
||||
<< acosD_F
|
||||
<< atanD_F
|
||||
<< log2_F
|
||||
<< log10_F
|
||||
<< log_F
|
||||
<< ln_F
|
||||
<< exp_F
|
||||
<< sqrt_F
|
||||
<< sign_F
|
||||
<< rint_F
|
||||
<< r2cm_F
|
||||
<< abs_F
|
||||
<< min_F
|
||||
<< max_F
|
||||
<< sum_F
|
||||
<< avg_F
|
||||
<< fmod_F;
|
||||
|
||||
// Postfix operators
|
||||
const QString cm_Oprt = QStringLiteral("cm");
|
||||
|
|
|
@ -336,6 +336,7 @@ extern const QString exp_F;
|
|||
extern const QString sqrt_F;
|
||||
extern const QString sign_F;
|
||||
extern const QString rint_F;
|
||||
extern const QString r2cm_F;
|
||||
extern const QString abs_F;
|
||||
extern const QString min_F;
|
||||
extern const QString max_F;
|
||||
|
|
|
@ -437,6 +437,7 @@ void VTranslateVars::InitFunctions()
|
|||
functions.insert(sqrt_F, translate("VTranslateVars", "sqrt", "square root of a value"));
|
||||
functions.insert(sign_F, translate("VTranslateVars", "sign", "sign function -1 if x<0; 1 if x>0"));
|
||||
functions.insert(rint_F, translate("VTranslateVars", "rint", "round to nearest integer"));
|
||||
functions.insert(r2cm_F, translate("VTranslateVars", "r2cm", "round to up to 1 decimal"));
|
||||
functions.insert(abs_F, translate("VTranslateVars", "abs", "absolute value"));
|
||||
functions.insert(min_F, translate("VTranslateVars", "min", "min of all arguments"));
|
||||
functions.insert(max_F, translate("VTranslateVars", "max", "max of all arguments"));
|
||||
|
|
Loading…
Reference in New Issue
Block a user