Home | History | Annotate | Download | only in navigation
      1 /*
      2  * To change this template, choose Tools | Templates
      3  * and open the template in the editor.
      4  */
      5 package jme3tools.navigation;
      6 
      7 /**
      8  * Provides various helper methods for number conversions (such as degree to radian
      9  * conversion, decimal degree to radians etc)
     10  * @author Benjamin Jakobus, based on JMarine (by Cormac Gebruers and Benjamin
     11  *          Jakobus)
     12  * @version 1.0
     13  * @since 1.0
     14  */
     15 public class NumUtil {
     16 
     17     /**
     18      * Rounds a number
     19      * @param Rval number to be rounded
     20      * @param Rpl number of decimal places
     21      * @return rounded number
     22      * @since 0.1
     23      */
     24     public float Round(float Rval, int Rpl) {
     25         float p = (float) Math.pow(10, Rpl);
     26         Rval = Rval * p;
     27         float tmp = Math.round(Rval);
     28         return (float) tmp / p;
     29     }
     30 }
     31