Package cnuphys.magfield
Class FastMath
java.lang.Object
cnuphys.magfield.FastMath
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumWhich atan2, etc. algorithms to usestatic final class
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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- 
FastMathpublic FastMath()
 
- 
- 
Method Details- 
atan2public static double atan2(float y, float x) Might use standard or fast atan2- Parameters:
- y-
- x-
- Returns:
- arctan(y/x) over 2Pi radians
 
- 
atan2public static double atan2(double y, double x) Might use standard or fast atan2- Parameters:
- y-
- x-
- Returns:
- arctan(y/x) over 2Pi radians
 
- 
atan2Degpublic static double atan2Deg(float y, float x) Might use standard or fast atan2- Parameters:
- y-
- x-
- Returns:
- arctan(y/x) over 360 degrees
 
- 
atan2Degpublic static double atan2Deg(double y, double x) Might use standard or fast atan2- Parameters:
- y-
- x-
- Returns:
- atan2(y, x)
 
- 
hypotpublic static double hypot(double x, double y) - Parameters:
- x-
- y-
- Returns:
 
- 
acospublic static double acos(double x) - Parameters:
- x-
- Returns:
 
- 
acos2Degpublic static double acos2Deg(double x) Arc cosine returned in degrees- Parameters:
- x- the cosine value
- Returns:
- acos in degrees
 
- 
sqrtpublic static double sqrt(double x) Fast version of usual square root- Parameters:
- x- the value
- Returns:
- the square root of x
 
- 
sinpublic static double sin(double x) Might use standard or fast sin- Parameters:
- x- the angle in radians
- Returns:
- the sine
 
- 
cospublic static double cos(double x) Might use standard or fast cos- Parameters:
- x- the angle in radians
- Returns:
- the cosine
 
- 
getMathLibGet the math lib being used- Returns:
- the math lib being used
 
- 
vectorLengthpublic static float vectorLength(float[] v) Vector length.- Parameters:
- v- the v
- Returns:
- the float
 
- 
setMathLibSet the math library to use- Parameters:
- lib- the math library enum
 
 
-