Constructor and Description |
---|
Math2() |
Modifier and Type | Method and Description |
---|---|
static double |
bind(double min,
double value,
double max)
Forces an input value to be in [min, max].
|
static double |
div(double a,
double b,
double c)
performs a division a/b with a fallback if a/b would result in a division by zero.
|
static double |
gauss(double x,
double sigma)
calculate the 1d gaussian derivation with mu = 0
|
static double |
gauss(double x,
double y,
double sigma)
calculate the gaussian derivation in 2d
|
static double[] |
getGauss(int size)
return a normalized gaussian kernel for the specified array size
|
static boolean |
isIn(double min,
double v,
double max)
checks if a value is in [min; max]
|
static boolean |
isIn(int min,
int v,
int max)
checks if a value is in [min; max]
|
static double |
pow(double a,
double b)
Method that wraps
Math.pow(double, double) and linearizes the calculation of the exponent up to power=64
which was faster on my machine in all tests. |
static Point2D |
rotate(int x,
int y,
double deg)
Rotate a point around the origin
|
static void |
toKarthesian(Point2D p)
Transforms the given point from polar to Karthesian coordinates.
|
static void |
toPolar(Point2D p)
Transforms the given point from karthesian to polar coordinates.
|
public static double div(double a, double b, double c)
a
- dividendb
- divisorc
- fallback if b = 0public static Point2D rotate(int x, int y, double deg)
x
- coordinatey
- coordinatedeg
- in degreespublic static double gauss(double x, double y, double sigma)
x
- coordinatey
- coordinatesigma
- standard deviationpublic static double gauss(double x, double sigma)
x
- coordinatesigma
- standard deviationpublic static double[] getGauss(int size)
size
- size of the resulting arraypublic static double bind(double min, double value, double max)
min
- min value (inclusive)value
- the value to checkmax
- max value (inclusive)public static boolean isIn(int min, int v, int max)
min
- lower boundv
- the value to checkmax
- upper boundpublic static boolean isIn(double min, double v, double max)
min
- lower boundv
- the value to checkmax
- upper boundpublic static void toPolar(Point2D p)
p
- the karthesian pointpublic static void toKarthesian(Point2D p)
p
- polar pointpublic static double pow(double a, double b)
Math.pow(double, double)
and linearizes the calculation of the exponent up to power=64
which was faster on my machine in all tests.a
- b
- Copyright © 2015. All Rights Reserved.