LazyLib

org.lazywizard.lazylib
Class VectorUtils

Object
  extended by VectorUtils

public class VectorUtils
extends Object

Contains methods for manipulating Vector2fs.

Since:
1.7
Author:
LazyWizard

Method Summary
static float getAngle(Vector2f from, Vector2f to)
          Returns the angle between two Vector2fs.
static float getCrossProduct(Vector2f vector1, Vector2f vector2)
          Returns the cross product of two Vector2fs.
static float getFacing(Vector2f vector)
          Returns the facing of a Vector2f.
static Vector2f rotate(Vector2f toRotate, float angle, Vector2f dest)
          Rotates a Vector2f by a specified amount.
static Vector2f rotateAroundPivot(Vector2f toRotate, Vector2f pivotPoint, float angle, Vector2f dest)
          Rotates a Vector2f by a specified amount around a pivot point.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFacing

public static float getFacing(Vector2f vector)
Returns the facing of a Vector2f.

Parameters:
vector - The vector to get the facing of.

Returns:
The facing (angle) of vector.

Since:
1.7

getAngle

public static float getAngle(Vector2f from,
                             Vector2f to)
Returns the angle between two Vector2fs.

Parameters:
from - The source Vector2f.
to - The Vector2f to get the angle to.

Returns:
The angle from from to to.

Since:
1.7

getCrossProduct

public static float getCrossProduct(Vector2f vector1,
                                    Vector2f vector2)
Returns the cross product of two Vector2fs.

Parameters:
vector1 - The first Vector2f.
vector2 - The second Vector2f.

Returns:
The cross product of the two vectors.

Since:
1.7

rotate

public static Vector2f rotate(Vector2f toRotate,
                              float angle,
                              Vector2f dest)
Rotates a Vector2f by a specified amount.

Parameters:
toRotate - The Vector2f to rotate.
angle - How much to rotate toRotate, in degrees.
dest - The destination Vector2f. Can be toRotate.

Returns:
A rotated version of toRotate placed in dest.

Since:
1.7

rotateAroundPivot

public static Vector2f rotateAroundPivot(Vector2f toRotate,
                                         Vector2f pivotPoint,
                                         float angle,
                                         Vector2f dest)
Rotates a Vector2f by a specified amount around a pivot point.

Parameters:
toRotate - The Vector2f to rotate.
pivotPoint - The central point to pivot around.
angle - How much to rotate toRotate, in degrees.
dest - The destination Vector2f. Can be toRotate.

Returns:
A rotated version of toRotate placed in dest.

Since:
1.7

LazyLib