Package mgui.util

Class MathFunctions

java.lang.Object
mgui.util.MathFunctions

public class MathFunctions
extends java.lang.Object
  • Constructor Summary

    Constructors
    Constructor Description
    MathFunctions()  
  • Method Summary

    Modifier and Type Method Description
    static double ceil​(double m, double n)
    Rounds m up to the next multiple of n
    static Jama.Matrix getMatrixFromPoint3d​(org.jogamp.vecmath.Point3d p)  
    static org.jogamp.vecmath.Point3d getPoint3dFromMatrix​(Jama.Matrix m)  
    static double interpolate​(double v1, double v2, double val)  
    static double logn​(double a, double n)
    Computes log to base n of a.
    static double normalize​(double min, double max, double val)
    Normalize val to the range [min:max].
    static double unnormalize​(double min, double max, double val)
    Unnormalize val to the range [min:max].

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MathFunctions

      public MathFunctions()
  • Method Details

    • interpolate

      public static double interpolate​(double v1, double v2, double val)
    • normalize

      public static double normalize​(double min, double max, double val)
      Normalize val to the range [min:max]. If val is outside the range [min:max], it is set to the nearest limit (0 or 1).
      Parameters:
      min -
      max -
      val -
      Returns:
      normalized value
    • unnormalize

      public static double unnormalize​(double min, double max, double val)
      Unnormalize val to the range [min:max].
      Parameters:
      min -
      max -
      val -
      Returns:
      normalized value
    • ceil

      public static double ceil​(double m, double n)
      Rounds m up to the next multiple of n
      Parameters:
      m -
      n -
      Returns:
    • getPoint3dFromMatrix

      public static org.jogamp.vecmath.Point3d getPoint3dFromMatrix​(Jama.Matrix m)
    • getMatrixFromPoint3d

      public static Jama.Matrix getMatrixFromPoint3d​(org.jogamp.vecmath.Point3d p)
    • logn

      public static double logn​(double a, double n)
      Computes log to base n of a.
      Parameters:
      a -
      n -
      Returns: