Package org.sunflow.math

# Class MathUtils

java.lang.Object
org.sunflow.math.MathUtils

public final class MathUtils extends Object

## Method Summary

Modifier and Type
Method
Description
`static 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 to `Math.pow(a, b)`.
`static final float`
`frac(float x)`
`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)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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)

### frac

public static final float frac(float x)

### fastPow

public static final float fastPow(float a, float b)
Computes a fast approximation to `Math.pow(a, b)`. Adapted from <url>http://www.dctsystems.co.uk/Software/power.html</url>.

Parameters:
  `a` - a positive number
  `b` - a number
Returns:
  a^b