diff options
| -rw-r--r-- | RELEASE_NOTES | 1 | ||||
| -rw-r--r-- | src/func.cc | 8 | 
2 files changed, 9 insertions, 0 deletions
diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 65f073d..e1c06b8 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -4,6 +4,7 @@ OpenSCAD 2010.03   .. ADD STUFF HERE ..   o Added functions and statements +  - Added abs() function    - Added exp(x), log(b, x), log(x) and ln(x) functions    - Added minkowski() statement for 3d minkowski sums   o Some bugs fixed, maybe some new bugs added diff --git a/src/func.cc b/src/func.cc index ca7a8d4..9f1b8e7 100644 --- a/src/func.cc +++ b/src/func.cc @@ -110,6 +110,13 @@ static double rad2deg(double x)  	return x;  } +Value builtin_abs(const Context *, const QVector<QString>&, const QVector<Value> &args) +{ +	if (args.size() == 1 && args[0].type == Value::NUMBER) +		return Value(fabs(args[0].num)); +	return Value(); +} +  Value builtin_min(const Context *, const QVector<QString>&, const QVector<Value> &args)  {  	if (args.size() >= 1 && args[0].type == Value::NUMBER) { @@ -284,6 +291,7 @@ Value builtin_lookup(const Context *, const QVector<QString>&, const QVector<Val  void initialize_builtin_functions()  { +	builtin_functions["abs"] = new BuiltinFunction(&builtin_abs);  	builtin_functions["min"] = new BuiltinFunction(&builtin_min);  	builtin_functions["max"] = new BuiltinFunction(&builtin_max);  	builtin_functions["sin"] = new BuiltinFunction(&builtin_sin);  | 
