public class Vectors extends Object
Modifier and Type | Field and Description |
---|---|
static IVector |
MAX_VALUE
A vector containing the maximum floating point value for all components.
|
static IVector |
MIN_VALUE
A vector containing the minimum floating point value for all components
(note: the components are -
Float.MAX_VALUE , not Float.MIN_VALUE ). |
static IVector |
UNIT_X
A unit vector in the X+ direction.
|
static IVector |
UNIT_Y
A unit vector in the Y+ direction.
|
static IVector |
ZERO
The zero vector.
|
Constructor and Description |
---|
Vectors() |
Modifier and Type | Method and Description |
---|---|
static boolean |
epsilonEquals(IVector v1,
IVector v2)
Returns true if the supplied vectors' x and y components are equal to one another within
MathUtil.EPSILON . |
static boolean |
epsilonEquals(IVector v1,
IVector v2,
float epsilon)
Returns true if the supplied vectors' x and y components are equal to one another within
epsilon . |
static Vector |
from(XY from,
XY to)
Creates a vector from
from to to . |
static Vector |
fromPolar(float magnitude,
float angle)
Creates a new vector from polar coordinates.
|
static Vector |
inverseTransform(float x,
float y,
float sx,
float sy,
float rotation,
Vector result)
Inverse transforms a vector as specified, storing the result in the vector provided.
|
static boolean |
isEpsilonZero(float x,
float y)
Returns true if the supplied vector's x and y components are
MathUtil.EPSILON close
to zero magnitude. |
static boolean |
isEpsilonZero(float x,
float y,
float epsilon)
Returns true if the supplied vector's x and y components are
epsilon close to zero
magnitude. |
static boolean |
isZero(float x,
float y)
Returns true if the supplied vector has zero magnitude.
|
static float |
length(float x,
float y)
Returns the magnitude of the specified vector.
|
static float |
lengthSq(float x,
float y)
Returns the square of the magnitude of the specified vector.
|
static Vector |
transform(float x,
float y,
float sx,
float sy,
float sina,
float cosa,
float tx,
float ty,
Vector result)
Transforms a vector as specified (as a point, accounting for translation), storing the
result in the vector provided.
|
static Vector |
transform(float x,
float y,
float sx,
float sy,
float rotation,
float tx,
float ty,
Vector result)
Transforms a vector as specified (as a point, accounting for translation), storing the
result in the vector provided.
|
static Vector |
transform(float x,
float y,
float sx,
float sy,
float sina,
float cosa,
Vector result)
Transforms a vector as specified, storing the result in the vector provided.
|
static Vector |
transform(float x,
float y,
float sx,
float sy,
float rotation,
Vector result)
Transforms a vector as specified, storing the result in the vector provided.
|
static String |
vectorToString(float x,
float y)
Returns a string describing the supplied vector, of the form
+x+y ,
+x-y , -x-y , etc. |
public static final IVector UNIT_X
public static final IVector UNIT_Y
public static final IVector ZERO
public static final IVector MIN_VALUE
Float.MAX_VALUE
, not Float.MIN_VALUE
).public static final IVector MAX_VALUE
public static Vector fromPolar(float magnitude, float angle)
public static float length(float x, float y)
public static float lengthSq(float x, float y)
public static boolean isZero(float x, float y)
public static boolean isEpsilonZero(float x, float y)
MathUtil.EPSILON
close
to zero magnitude.public static boolean isEpsilonZero(float x, float y, float epsilon)
epsilon
close to zero
magnitude.public static boolean epsilonEquals(IVector v1, IVector v2)
MathUtil.EPSILON
.public static boolean epsilonEquals(IVector v1, IVector v2, float epsilon)
epsilon
.public static Vector transform(float x, float y, float sx, float sy, float rotation, float tx, float ty, Vector result)
public static Vector transform(float x, float y, float sx, float sy, float rotation, Vector result)
public static Vector transform(float x, float y, float sx, float sy, float sina, float cosa, Vector result)
public static Vector transform(float x, float y, float sx, float sy, float sina, float cosa, float tx, float ty, Vector result)
public static Vector inverseTransform(float x, float y, float sx, float sy, float rotation, Vector result)
public static String vectorToString(float x, float y)
+x+y
,
+x-y
, -x-y
, etc.Copyright © 2017. All rights reserved.