public class MathUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static double |
DISTANCE_DELTA |
| Constructor and Description |
|---|
MathUtils() |
| Modifier and Type | Method and Description |
|---|---|
static double |
absoluteValue(Vector v)
Returns the absalute value (or length) of the vector
|
static Vector |
addVectorToVector(Vector a,
Vector b) |
static Vector |
crossProduct(Vector a,
Vector b)
Calculate the cross product of 2 vectors.
|
static double |
distance(Point start,
Point end) |
static double |
getAngle(Vector a,
Vector b)
Calculate the angle between vector a vector b
|
static double |
getDirectionAngle(Vector v)
Returns the angle of the vector again the x-axis
|
static Point |
getIntersection(Point a,
Vector u,
Point b,
Vector v) |
static Point |
getPointOfStraightLine(Point a,
Vector direction,
double parameter)
Calculate a point of a straigt line.
|
static int |
getQuadrant(double angle)
Returns the qaudrant for the given angle:
0,1,2 or 3 |
static int |
getQuadrant(Point p,
Point center)
Returns the qaudrant:
0,1,2 or 3 |
static Vector |
getVector(Point a,
Point b)
Calculate the vector from point a to point b
|
static Vector |
invertDirection(Vector v)
Invert the direction of the given vector
|
static double[][] |
multiplyMatrixByMatrix(double[][] a,
double[][] b) |
static double[] |
multiplyMatrixByVector(double[][] a,
double[] v) |
static Vector |
normalize(Vector v) |
static Point |
rotatePointXY(Point p,
Point center,
double angle)
Rotate the given point around centerpoint with the given angle in X-Y
plane.
|
static double |
scalarProduct(Vector a,
Vector b)
Calculate the scalar product of vector a and vector b
|
static Vector |
scaleVector(Vector a,
double scale)
Scale a vector with the given value
|
static Vector |
subtractVectorByVector(Vector a,
Vector b)
Substracts a vector from other vector.
|
public static final double DISTANCE_DELTA
public static double scalarProduct(Vector a, Vector b)
a - b - public static double absoluteValue(Vector v)
v - public static Vector crossProduct(Vector a, Vector b)
a - b - public static Vector scaleVector(Vector a, double scale)
a - the vectorscale - the value to scalepublic static Point getPointOfStraightLine(Point a, Vector direction, double parameter)
a - the startpoint of the straight linedirection - the direction vector of the straight lineparameter - the parameterpublic static Vector getVector(Point a, Point b)
a - b - public static double getAngle(Vector a, Vector b)
a - b - public static Point rotatePointXY(Point p, Point center, double angle)
p - the point to rotatecenter - the centerpointangle - in radianpublic static int getQuadrant(Point p, Point center)
p - center - public static int getQuadrant(double angle)
angle - in degreepublic static double getDirectionAngle(Vector v)
v - the vectorpublic static Vector invertDirection(Vector v)
the - vector to invertpublic static double[][] multiplyMatrixByMatrix(double[][] a,
double[][] b)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic static double[] multiplyMatrixByVector(double[][] a,
double[] v)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic static Vector subtractVectorByVector(Vector a, Vector b)
a - the minuendb - the subtrahend