public final class UtilityMath
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static double |
cos(double degree)
Get cosinus in degree.
|
static Line |
createLine()
Create a line.
|
static Line |
createLine(double x1,
double y1,
double x2,
double y2)
Create a line.
|
static Polygon |
createPolygon()
Create a polygon.
|
static Rectangle |
createRectangle()
Create a rectangle.
|
static Rectangle |
createRectangle(double x,
double y,
double w,
double h)
Create a rectangle.
|
static double |
curveValue(double value,
double dest,
double speed)
Apply progressive modifications to a value.
|
static double |
fixBetween(double value,
double min,
double max)
Fix a value between an interval.
|
static int |
fixBetween(int value,
int min,
int max)
Fix a value between an interval.
|
static double |
getDistance(double x1,
double y1,
double x2,
double y2)
Get distance of two points.
|
static int |
getDistance(int x1,
int y1,
int x2,
int y2)
Get integer distance of two points.
|
static int |
getDistance(int tx1,
int ty1,
int tw1,
int th1,
int tx2,
int ty2,
int tw2,
int th2)
Get distance in tile between the area.
|
static int |
getRounded(int value,
int round)
Get the rounded value.
|
static int |
getSign(int value)
Get the sign of a value.
|
static Coord |
intersection(Line l1,
Line l2)
Get the intersection point of two lines.
|
static long |
nano()
Get the current time in nano second.
|
static double |
sin(double degree)
Get sinus in degree.
|
static long |
time()
Get the current time in millisecond.
|
static double |
wrapDouble(double value,
double min,
double max)
Wrap value (keep value between min and max).
|
public static Line createLine()
public static Line createLine(double x1, double y1, double x2, double y2)
x1
- The x coordinate of the start point.y1
- The y coordinate of the start point.x2
- The x coordinate of the end point.y2
- The y coordinate of the end point.public static Polygon createPolygon()
public static Rectangle createRectangle()
public static Rectangle createRectangle(double x, double y, double w, double h)
x
- The horizontal location.y
- The vertical location.w
- The rectangle width.h
- The rectangle height.public static int fixBetween(int value, int min, int max)
value
- The value to fix.min
- The minimum value.max
- The maximum value.public static double fixBetween(double value, double min, double max)
value
- The value to fix.min
- The minimum value.max
- The maximum value.public static double curveValue(double value, double dest, double speed)
value
- The value.dest
- The value to reach.speed
- The effect speed.public static Coord intersection(Line l1, Line l2)
l1
- The first line.l2
- The second line.public static int getDistance(int x1, int y1, int x2, int y2)
x1
- The point 1 x.y1
- The point 1 y.x2
- The point 2 x.y2
- The point 2 y.public static double getDistance(double x1, double y1, double x2, double y2)
x1
- The point 1 x.y1
- The point 1 y.x2
- The point 2 x.y2
- The point 2 y.public static int getDistance(int tx1, int ty1, int tw1, int th1, int tx2, int ty2, int tw2, int th2)
tx1
- The first tile x.ty1
- The first tile y.tw1
- The first width in tile.th1
- The first height in tile.tx2
- The second tile x.ty2
- The second tile y.tw2
- The second width in tile.th2
- The second height in tile.public static double wrapDouble(double value, double min, double max)
value
- The input value.min
- The minimum value (included).max
- The maximum value (excluded).public static int getRounded(int value, int round)
value
- The value.round
- The round factor.public static double cos(double degree)
degree
- The angle in degree.public static double sin(double degree)
degree
- The angle in degree.public static int getSign(int value)
value
- The value to check (must be != 0).public static long time()
public static long nano()