|
static Vector2D | add (final Vector2D v0, final Vector2D v1) |
|
static Vector2D | sub (final Vector2D v0, final Vector2D v1) |
|
static Vector2D | mult (final Vector2D v, double d) |
|
static Vector2D | div (final Vector2D v, double d) |
|
static double | distSq (final Vector2D v0, final Vector2D v1) |
|
static double | dist (final Vector2D v0, final Vector2D v1) |
|
static double | dot (final Vector2D v0, final Vector2D v1) |
|
static Vector2D | normalize (final Vector2D v) |
|
static double | angleBetween (Vector2D v0, Vector2D v1) |
|
static boolean | isSecondInFOVofFirst (final Vector2D posFirst, final Vector2D facingFirst, final Vector2D posSecond, double fov) |
|
sprites.maths.Vector2D.Vector2D |
( |
| ) |
|
Default to the zero vector
sprites.maths.Vector2D.Vector2D |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
Create a vector based on parameter values.
- Parameters
-
sprites.maths.Vector2D.Vector2D |
( |
final Vector2D |
v | ) |
|
Copy constructor
- Parameters
-
void sprites.maths.Vector2D.add |
( |
final Vector2D |
v | ) |
|
Add a vector to this one
- Parameters
-
void sprites.maths.Vector2D.add |
( |
double |
dx, |
|
|
double |
dy |
|
) |
| |
Change the vector by the values specified
- Parameters
-
Get a new vector that is the sum of 2 vectors.
- Parameters
-
v0 | first vector |
v1 | second vector |
- Returns
- the sum of the 2 vectors
double sprites.maths.Vector2D.angleBetween |
( |
final Vector2D |
v | ) |
|
Calculate the angle between this and another vector.
- Parameters
-
- Returns
- the angle betwwen in radians
Calculate the angle between two vectors.
- Parameters
-
v0 | first vector |
v1 | second vector |
- Returns
- the angle between in radians
double sprites.maths.Vector2D.distance |
( |
final Vector2D |
v | ) |
|
Get the distance between this and an other point.
- Parameters
-
- Returns
- distance to other point
double sprites.maths.Vector2D.distanceSq |
( |
final Vector2D |
v | ) |
|
Get the distance squared between this and an other point.
- Parameters
-
- Returns
- distance to other point squared
void sprites.maths.Vector2D.div |
( |
double |
d | ) |
|
Divide the vector by a scalar
- Parameters
-
Get a new vector that is a vector divided by a scalar
- Parameters
-
v | the original vector |
d | the divisor |
- Returns
- the calculated vector
double sprites.maths.Vector2D.dot |
( |
final Vector2D |
v | ) |
|
Calculate the dot product between two un-normalised vectors.
- Parameters
-
- Returns
- the dot product
double sprites.maths.Vector2D.dotNorm |
( |
final Vector2D |
v | ) |
|
Calculate the dot product between two normalised vectors i.e. the cosine of the angle between them
- Parameters
-
- Returns
Vector2D sprites.maths.Vector2D.getPerp |
( |
| ) |
|
Get a vector perpendicular to this one.
- Returns
- a perpendicular vector
Return the reflection vector about the norm
- Parameters
-
- Returns
- the reflected vector
Vector2D sprites.maths.Vector2D.getReverse |
( |
| ) |
|
Get a vector that is the reverse of this vector
- Returns
- the reverse vector
static boolean sprites.maths.Vector2D.isSecondInFOVofFirst |
( |
final Vector2D |
posFirst, |
|
|
final Vector2D |
facingFirst, |
|
|
final Vector2D |
posSecond, |
|
|
double |
fov |
|
) |
| |
|
static |
Determines whether entity 2 is visible from entity 1.
- Parameters
-
posFirst | position of first entity |
facingFirst | direction first entity is facing |
posSecond | position of second entity |
fov | field of view (radians) |
- Returns
double sprites.maths.Vector2D.length |
( |
| ) |
|
double sprites.maths.Vector2D.lengthSq |
( |
| ) |
|
Get the vector length squared
void sprites.maths.Vector2D.mult |
( |
double |
d | ) |
|
Multiply the vector by a scalar
- Parameters
-
Get a new vector that is the product of a vector and a scalar
- Parameters
-
v | the original vector |
d | the multiplier |
- Returns
- the calculated vector
void sprites.maths.Vector2D.normalize |
( |
| ) |
|
Get a new vector that is the given vector normalised
- Parameters
-
- Returns
- the normalised vector
int sprites.maths.Vector2D.sign |
( |
final Vector2D |
v | ) |
|
Determines whether vector v is clockwise of this vector.
- Parameters
-
- Returns
- positive (+1) if clockwise else negative (-1)
Get a new vector that is the difference between the 2 vectors.
- Parameters
-
v0 | first vector |
v1 | second vector |
- Returns
- the difference between the 2 vectors
double [] sprites.maths.Vector2D.toArray |
( |
| ) |
|
Get the coordinates as an array.
- Returns
void sprites.maths.Vector2D.truncate |
( |
double |
max | ) |
|
Truncate this vector so its length is no greater than the value provided.
- Parameters
-
max | maximum size for this vector |
Opposite of the first canonical vector (coordinates: -1, 0).
Opposite of the second canonical vector (coordinates: 0, -1).
final Vector2D sprites.maths.Vector2D.NaN = new Vector2D(Double.NaN, Double.NaN) |
|
static |
A vector with all coordinates set to NaN.
final Vector2D sprites.maths.Vector2D.NEGATIVE_INFINITY |
|
static |
Initial value:=
new Vector2D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY)
A vector with all coordinates set to negative infinity.
Null vector (coordinates: 1, 1).
First canonical vector (coordinates: 1, 0).
Second canonical vector (coordinates: 0, 1).
final Vector2D sprites.maths.Vector2D.POSITIVE_INFINITY |
|
static |
Initial value:=
new Vector2D(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY)
A vector with all coordinates set to positive infinity.
Null vector (coordinates: 0, 0).
The documentation for this class was generated from the following file:
- /Users/peter/git/sprites-repos/Sprites 4P/src/sprites/maths/Vector2D.java