diff options
Diffstat (limited to 'engine/src/desktop/jme3tools/navigation/NumUtil.java')
-rw-r--r-- | engine/src/desktop/jme3tools/navigation/NumUtil.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/engine/src/desktop/jme3tools/navigation/NumUtil.java b/engine/src/desktop/jme3tools/navigation/NumUtil.java new file mode 100644 index 0000000..086fff2 --- /dev/null +++ b/engine/src/desktop/jme3tools/navigation/NumUtil.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package jme3tools.navigation; + +/** + * Provides various helper methods for number conversions (such as degree to radian + * conversion, decimal degree to radians etc) + * @author Benjamin Jakobus, based on JMarine (by Cormac Gebruers and Benjamin + * Jakobus) + * @version 1.0 + * @since 1.0 + */ +public class NumUtil { + + /** + * Rounds a number + * @param Rval number to be rounded + * @param Rpl number of decimal places + * @return rounded number + * @since 0.1 + */ + public float Round(float Rval, int Rpl) { + float p = (float) Math.pow(10, Rpl); + Rval = Rval * p; + float tmp = Math.round(Rval); + return (float) tmp / p; + } +} |