public class Vectors extends Object
Modifier and Type | Field and Description |
---|---|
static IVector |
MAX_VALUE
A vector containing the maximum doubleing point value for all components.
|
static IVector |
MIN_VALUE
A vector containing the minimum doubleing 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,
double 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(double magnitude,
double angle)
Creates a new vector from polar coordinates.
|
static Vector |
inverseTransform(double x,
double y,
double sx,
double sy,
double rotation,
Vector result)
Inverse transforms a vector as specified, storing the result in the vector provided.
|
static boolean |
isEpsilonZero(double x,
double y)
Returns true if the supplied vector's x and y components are
MathUtil.EPSILON close
to zero magnitude. |
static boolean |
isEpsilonZero(double x,
double y,
double epsilon)
Returns true if the supplied vector's x and y components are
epsilon close to zero
magnitude. |
static boolean |
isZero(double x,
double y)
Returns true if the supplied vector has zero magnitude.
|
static double |
length(double x,
double y)
Returns the magnitude of the specified vector.
|
static double |
lengthSq(double x,
double y)
Returns the square of the magnitude of the specified vector.
|
static Vector |
transform(double x,
double y,
double sx,
double sy,
double sina,
double cosa,
double tx,
double ty,
Vector result)
Transforms a vector as specified (as a point, accounting for translation), storing the
result in the vector provided.
|
static Vector |
transform(double x,
double y,
double sx,
double sy,
double rotation,
double tx,
double ty,
Vector result)
Transforms a vector as specified (as a point, accounting for translation), storing the
result in the vector provided.
|
static Vector |
transform(double x,
double y,
double sx,
double sy,
double sina,
double cosa,
Vector result)
Transforms a vector as specified, storing the result in the vector provided.
|
static Vector |
transform(double x,
double y,
double sx,
double sy,
double rotation,
Vector result)
Transforms a vector as specified, storing the result in the vector provided.
|
static String |
vectorToString(double x,
double 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(double magnitude, double angle)
public static double length(double x, double y)
public static double lengthSq(double x, double y)
public static boolean isZero(double x, double y)
public static boolean isEpsilonZero(double x, double y)
MathUtil.EPSILON
close
to zero magnitude.public static boolean isEpsilonZero(double x, double y, double epsilon)
epsilon
close to zero
magnitude.public static boolean epsilonEquals(IVector v1, IVector v2)
MathUtil.EPSILON
.public static boolean epsilonEquals(IVector v1, IVector v2, double epsilon)
epsilon
.public static Vector transform(double x, double y, double sx, double sy, double rotation, double tx, double ty, Vector result)
public static Vector transform(double x, double y, double sx, double sy, double rotation, Vector result)
public static Vector transform(double x, double y, double sx, double sy, double sina, double cosa, Vector result)
public static Vector transform(double x, double y, double sx, double sy, double sina, double cosa, double tx, double ty, Vector result)
public static Vector inverseTransform(double x, double y, double sx, double sy, double rotation, Vector result)
public static String vectorToString(double x, double y)
+x+y
,
+x-y
, -x-y
, etc.Copyright © 2017. All rights reserved.