java.lang.Object
org.sunflow.math.MathUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic final double
clamp
(double x, double min, double max) static final float
clamp
(float x, float min, float max) static final int
clamp
(int x, int min, int max) static final float
fastPow
(float a, float b) Computes a fast approximation toMath.pow(a, b)
.static final double
max
(double a, double b, double c) static final float
max
(float a, float b, float c) static final float
max
(float a, float b, float c, float d) static final int
max
(int a, int b, int c) static final double
min
(double a, double b, double c) static final float
min
(float a, float b, float c) static final float
min
(float a, float b, float c, float d) static final int
min
(int a, int b, int c) static final float
smoothStep
(float a, float b, float x)
-
Method Details
-
clamp
public static final int clamp(int x, int min, int max) -
clamp
public static final float clamp(float x, float min, float max) -
clamp
public static final double clamp(double x, double min, double max) -
min
public static final int min(int a, int b, int c) -
min
public static final float min(float a, float b, float c) -
min
public static final double min(double a, double b, double c) -
min
public static final float min(float a, float b, float c, float d) -
max
public static final int max(int a, int b, int c) -
max
public static final float max(float a, float b, float c) -
max
public static final double max(double a, double b, double c) -
max
public static final float max(float a, float b, float c, float d) -
smoothStep
public static final float smoothStep(float a, float b, float x) -
fastPow
public static final float fastPow(float a, float b) Computes a fast approximation toMath.pow(a, b)
. Adapted fromhttp://www.dctsystems.co.uk/Software/power.html .- Parameters:
a
- a positive numberb
- a number- Returns:
- a^b
-