Table of Contents

<Utility Classes|User's Guide|Line>

Fast Math

See Javadoc

Definition

FastMath provides a number of convience methods, and where possible faster versions (although this can be at the sake of accuracy).

Usage

FastMath provides a number of constants that can help with general math equations. One important attribute is USE_FAST_TRIG if you set this to true, a look-up table will be used for trig functions rather than Java's standard Math library. This provides significant speed increases, but might suffer from accuracy so care should be taken.

There are five major categories of functions that FastMath provides.

Trig Functions

  • cos and acos - provide cosine and arc cosine values (make use of the look-up table if USE_FAST_TRIG is true)
  • sin and asin - provide sine and arc sine values (make use of the look-up table if USE_FAST_TRIG is true)
  • tan and atan - provide tangent and arc tangent values

Numerical Methods

  • ceil - provides the ceiling (smallest value that is greater than or equal to a given value and an integer)of a value.
  • floor - provides the floor (largest value that is less than or equal to a given value and an integer) of a value.
  • exp - provides the euler number (e) raised to the provided value.
  • sqr - provides the square of a value (i.e. value * value).
  • pow - provides the first given number raised to the second.
  • isPowerOfTwo - provides a boolean if a value is a power of two or not (e.g. 32, 64, 4).
  • abs - provides the absolute value of a given number.
  • sign - provides the sign of a value (1 if positive, -1 if negative, 0 if 0).
  • log - provides the natural logarithm of a value.
  • sqrt - provides the square root of a value.
  • invSqrt - provides the inverse square root of a value (1 / sqrt(value).

Linear Algebra

Geometric Functions

Misc.

  • newRandomFloat - obtains a random float.

<Utility Classes|User's Guide|Line>


/var/www/wiki/data/pages/fastmath.txt · Last modified: 2009/07/28 18:44 (external edit)  
Recent changes · Show pagesource · Login

Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki

subscribe to jME latest jme headlines


site design by bleedcrimson designs © 2008