java.lang.Object
io.qt.core.QMath
public final class QMath extends Object
Provides additional math functions.
-
Method Summary
Modifier and Type Method Description static byte
bound(byte min, byte val, byte max)
Returns val bounded by min and max.static double
bound(double min, double val, double max)
Returns val bounded by min and max.static float
bound(float min, float val, float max)
Returns val bounded by min and max.static int
bound(int min, int val, int max)
Returns val bounded by min and max.static long
bound(long min, long val, long max)
Returns val bounded by min and max.static short
bound(short min, short val, short max)
Returns val bounded by min and max.static boolean
fuzzyCompare(double p1, double p2)
Compares the floating point value p1 and p2 and returns true if they are considered equal, otherwise false.static boolean
fuzzyCompare(float p1, float p2)
Compares the floating point value p1 and p2 and returns true if they are considered equal, otherwise false.static boolean
fuzzyIsNull(double d)
Returns true if the absolute value of d is within 0.000000000001 of 0.0.static boolean
fuzzyIsNull(float f)
Returns true if the absolute value of f is within 0.00001f of 0.0.
-
Method Details
-
fuzzyCompare
public static boolean fuzzyCompare(double p1, double p2)Compares the floating point value p1 and p2 and returns true if they are considered equal, otherwise false.- Parameters:
p1
-p2
-- Returns:
- compare
-
fuzzyCompare
public static boolean fuzzyCompare(float p1, float p2)Compares the floating point value p1 and p2 and returns true if they are considered equal, otherwise false.- Parameters:
p1
-p2
-- Returns:
- compare
-
fuzzyIsNull
public static boolean fuzzyIsNull(double d)Returns true if the absolute value of d is within 0.000000000001 of 0.0.- Parameters:
d
-- Returns:
- is null
-
fuzzyIsNull
public static boolean fuzzyIsNull(float f)Returns true if the absolute value of f is within 0.00001f of 0.0.- Parameters:
d
-- Returns:
- is null
-
bound
public static byte bound(byte min, byte val, byte max)Returns val bounded by min and max.- Parameters:
min
-val
-max
-- Returns:
- bounded value
-
bound
public static short bound(short min, short val, short max)Returns val bounded by min and max.- Parameters:
min
-val
-max
-- Returns:
- bounded value
-
bound
public static int bound(int min, int val, int max)Returns val bounded by min and max.- Parameters:
min
-val
-max
-- Returns:
- bounded value
-
bound
public static long bound(long min, long val, long max)Returns val bounded by min and max.- Parameters:
min
-val
-max
-- Returns:
- bounded value
-
bound
public static float bound(float min, float val, float max)Returns val bounded by min and max.- Parameters:
min
-val
-max
-- Returns:
- bounded value
-
bound
public static double bound(double min, double val, double max)Returns val bounded by min and max.- Parameters:
min
-val
-max
-- Returns:
- bounded value
-