public class VectorUtils
extends Object
Vector2f
s.Modifier and Type | Method and Description |
---|---|
static float |
getAngle(Vector2f from,
Vector2f to)
Returns the angle between two
Vector2f s. |
static float |
getCrossProduct(Vector2f vector1,
Vector2f vector2)
Returns the cross product of two
Vector2f s. |
static Vector2f |
getDirectionalVector(Vector2f source,
Vector2f destination)
|
static float |
getFacing(Vector2f vector)
Returns the facing (angle) of a
Vector2f . |
static List<Vector2f> |
rotate(List<Vector2f> toRotate,
float angle)
Rotates a
List of Vector2f s by a specified amount. |
static Vector2f |
rotate(Vector2f toRotate,
float angle,
Vector2f dest)
Rotates a
Vector2f by a specified amount. |
static List<Vector2f> |
rotateAroundPivot(List<Vector2f> toRotate,
Vector2f pivotPoint,
float angle)
Rotates a
List of Vector2f s by a specified amount around
a pivot point. |
static Vector2f |
rotateAroundPivot(Vector2f toRotate,
Vector2f pivotPoint,
float angle,
Vector2f dest)
Rotates a
Vector2f by a specified amount around a pivot point. |
public static float getFacing(Vector2f vector)
Vector2f
.vector
- The vector to get the facing of.
vector
in degrees, or 0 if the
vector has no length.
public static float getAngle(Vector2f from, Vector2f to)
Vector2f
s.public static Vector2f getDirectionalVector(Vector2f source, Vector2f destination)
source
- The origin of the vector.destination
- The location to point at.
Vector2f
pointing at destination
.
public static float getCrossProduct(Vector2f vector1, Vector2f vector2)
Vector2f
s.public static Vector2f rotate(Vector2f toRotate, float angle, Vector2f dest)
Vector2f
by a specified amount.public static List<Vector2f> rotate(List<Vector2f> toRotate, float angle)
List
of Vector2f
s by a specified amount. Much
more efficient than rotating each point individually.public static Vector2f rotateAroundPivot(Vector2f toRotate, Vector2f pivotPoint, float angle, Vector2f dest)
Vector2f
by a specified amount around a pivot point.