Class FastMath
java.lang.Object
cnuphys.magfield.FastMath
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhich atan2, etc. algorithms to usestatic final class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleacos(double x) static doubleacos2Deg(double x) Arc cosine returned in degreesstatic doubleatan2(double y, double x) Might use standard or fast atan2static doubleatan2(float y, float x) Might use standard or fast atan2static doubleatan2Deg(double y, double x) Might use standard or fast atan2static doubleatan2Deg(float y, float x) Might use standard or fast atan2static doublecos(double x) Might use standard or fast cosstatic FastMath.MathLibGet the math lib being usedstatic doublehypot(double x, double y) static voidSet the math library to usestatic doublesin(double x) Might use standard or fast sinstatic doublesqrt(double x) Fast version of usual square rootstatic floatvectorLength(float[] v) Vector length.
-
Constructor Details
-
FastMath
public FastMath()
-
-
Method Details
-
atan2
public static double atan2(float y, float x) Might use standard or fast atan2- Parameters:
y-x-- Returns:
- arctan(y/x) over 2Pi radians
-
atan2
public static double atan2(double y, double x) Might use standard or fast atan2- Parameters:
y-x-- Returns:
- arctan(y/x) over 2Pi radians
-
atan2Deg
public static double atan2Deg(float y, float x) Might use standard or fast atan2- Parameters:
y-x-- Returns:
- arctan(y/x) over 360 degrees
-
atan2Deg
public static double atan2Deg(double y, double x) Might use standard or fast atan2- Parameters:
y-x-- Returns:
- atan2(y, x)
-
hypot
public static double hypot(double x, double y) - Parameters:
x-y-- Returns:
-
acos
public static double acos(double x) - Parameters:
x-- Returns:
-
acos2Deg
public static double acos2Deg(double x) Arc cosine returned in degrees- Parameters:
x- the cosine value- Returns:
- acos in degrees
-
sqrt
public static double sqrt(double x) Fast version of usual square root- Parameters:
x- the value- Returns:
- the square root of x
-
sin
public static double sin(double x) Might use standard or fast sin- Parameters:
x- the angle in radians- Returns:
- the sine
-
cos
public static double cos(double x) Might use standard or fast cos- Parameters:
x- the angle in radians- Returns:
- the cosine
-
getMathLib
Get the math lib being used- Returns:
- the math lib being used
-
vectorLength
public static float vectorLength(float[] v) Vector length.- Parameters:
v- the v- Returns:
- the float
-
setMathLib
Set the math library to use- Parameters:
lib- the math library enum
-