pythagoras.f

Class Vectors

• ```public class Vectors
extends Object```
Vector-related utility methods.
• Field Summary

Fields
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 Summary

Constructors
Constructor and Description
`Vectors()`
• Method Summary

All Methods
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.
• Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Field Detail

• UNIT_X

`public static final IVector UNIT_X`
A unit vector in the X+ direction.
• UNIT_Y

`public static final IVector UNIT_Y`
A unit vector in the Y+ direction.
• ZERO

`public static final IVector ZERO`
The zero vector.
• MAX_VALUE

`public static final IVector MAX_VALUE`
A vector containing the maximum floating point value for all components.
• Constructor Detail

• Vectors

`public Vectors()`
• Method Detail

• fromPolar

```public static Vector fromPolar(float magnitude,
float angle)```
Creates a new vector from polar coordinates.
• from

```public static Vector from(XY from,
XY to)```
Creates a vector from `from` to `to`.
• length

```public static float length(float x,
float y)```
Returns the magnitude of the specified vector.
• lengthSq

```public static float lengthSq(float x,
float y)```
Returns the square of the magnitude of the specified vector.
• isZero

```public static boolean isZero(float x,
float y)```
Returns true if the supplied vector has zero magnitude.
• isEpsilonZero

```public 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.
• isEpsilonZero

```public 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.
• epsilonEquals

```public 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`.
• epsilonEquals

```public 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`.
• transform

```public 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.
Returns:
a reference to the result vector, for chaining.
• transform

```public 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.
Returns:
a reference to the result vector, for chaining.
• transform

```public 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.
Returns:
a reference to the result vector, for chaining.
• transform

```public 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.
Returns:
a reference to the result vector, for chaining.
• inverseTransform

```public 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.
Returns:
a reference to the result vector, for chaining.
• vectorToString

```public static String vectorToString(float x,
float y)```
Returns a string describing the supplied vector, of the form `+x+y`, `+x-y`, `-x-y`, etc.