net.dzzd.utils
Class MathX
java.lang.Object
net.dzzd.utils.MathX
- public class MathX
- extends java.lang.Object
MathX class.
Base class used by 3DzzD Web 3D Engine to include faster and/or smarter maths functions
Some results comparaison between Math.cos and MathX.cos function, MathX.cos seems to be 0.5 to 20 times faster than Math.cos function and give more accurate results especially for PI/2
-PI
MathX.cos(-Math.PI) =-1.0
Math.cos(-Math.PI) =-1.0
PI
MathX.cos(Math.PI) =-1.0
Math.cos(Math.PI) =-1.0
Root(2)/2=0.7071067811865476
PI/4
MathX.cos(Math.PI*0.25) =0.7071067811865476
Math.cos(Math.PI*0.25) =0.7071067811865476
PI/2
MathX.cos(Math.PI*0.25) =0.0
Math.cos(Math.PI*0.25) =6.123233995736766E-17
-PI/4
MathX.cos(-Math.PI*0.25)=0.7071067811865476
Math.cos(-Math.PI*0.25) =0.7071067811865476
-PI/2
MathX.cos(-Math.PI*0.5) =0.0
Math.cos(-Math.PI*0.5) =6.123233995736766E-17
- Since:
- 1.0
- Version:
- 1.0, 01/03/07
- Author:
- Bruno Augier (DzzD)
- See Also:
IRender3D
,
IMesh3D
,
DzzD
,
http://dzzd.net/
Field Summary |
static double |
PI
|
Constructor Summary |
MathX()
|
Method Summary |
static double |
cos(double x)
Compute and return cosinus of its parameter using taylor serie |
static double |
sin(double x)
Compute and return sinus of its parameter using taylor serie |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PI
public static double PI
MathX
public MathX()
sin
public static final double sin(double x)
- Compute and return sinus of its parameter using taylor serie
- Parameters:
x
- angle in radian to
- Returns:
- sinus value for the given parameter
cos
public static final double cos(double x)
- Compute and return cosinus of its parameter using taylor serie
- Parameters:
x
- angle in radian to
- Returns:
- cosinus value for the given parameter