Vector2 and Vector3 for specific implementations.
| Modifier and Type | Method and Description |
|---|---|
| public T | |
| public T | Returns: This vector for chainingMin length min, float Max length max)Clamps this vector's length to given min and max values |
| public T | |
| public float | |
| public float | |
| public float | Returns: the squared distance between this and the other vectorThe other vector v)This method is faster than |
| public boolean | Returns: whether the vectors have fuzzy equality.Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing. |
| public boolean | hasOppositeDirection(T other)
Returns: Whether this vector has opposite direction compared to the other vector. |
| public boolean | hasSameDirection(T other)
Returns: Whether this vector has similar direction compared to the other vector. |
| public T | Returns: This vector for chaining.The target vector target, float The interpolation coefficient alpha, Interpolation An Interpolation object describing the used interpolation method interpolator)Interpolates between this vector and the given target vector by alpha (within range [0,1]) using the given Interpolation method. |
| public boolean | isCollinear(T other, float epsilon)
Returns: true if this vector is collinear with the other vector ( |
| public boolean | isCollinear(T other)
Returns: true if this vector is collinear with the other vector ( |
| public boolean | isCollinearOpposite(T other, float epsilon)
Returns: true if this vector is opposite collinear with the other vector ( |
| public boolean | isCollinearOpposite(T other)
Returns: true if this vector is opposite collinear with the other vector ( |
| public boolean | isOnLine(T other, float epsilon)
Returns: true if this vector is in line with the other vector (either in the same or the opposite direction) |
| public boolean | isOnLine(T other)
Returns: true if this vector is in line with the other vector (either in the same or the opposite direction) |
| public boolean | |
| public boolean | isPerpendicular(T other, float
a positive small number close to zero epsilon)Returns: Whether this vector is perpendicular with the other vector. |
| public boolean | |
| public boolean | isUnit(final float margin)
Returns: Whether this vector is a unit length vector within the given margin. |
| public boolean | |
| public boolean | isZero(final float margin)
Returns: Whether the length of this vector is smaller than the given margin |
| public float | |
| public float | Returns: The squared Euclidean lengthThis method is faster than |
| public T | Returns: This vector for chaining.The target vector target, float The interpolation coefficient alpha)Linearly interpolates between this vector and the target vector by alpha which is in the range [0,1]. |
| public T | Returns: this vector for chainingdesired maximum length for this vector limit)Limits the length of this vector, based on the desired maximum length. |
| public T | Returns: this vector for chainingsquared desired maximum length for this vector limit2)Limits the length of this vector, based on the desired maximum length squared. |
| public T | mulAdd(T
addition vector v, float for scaling the addition vector scalar)First scale a supplied vector, then add it to this vector. |
| public T | mulAdd(T
addition vector v, T vector by whose values the addition vector will be scaled mulVec)First scale a supplied vector, then add it to this vector. |
| public T | |
| public T | |
| public T | |
| public T | |
| public T | Returns: this vector for chainingdesired length for this vector len)Sets the length of this vector. |
| public T | Returns: this vector for chainingdesired square of the length for this vector len2)Sets the length of this vector, based on the square of the desired length. |
| public T | Returns: This vector for chainingSets this vector to the unit vector with a random direction |
| public T | |
| public T |
| add | back to summary |
|---|---|
| public T add(T v) Adds the given vector to this vector
| |
| clamp | back to summary |
|---|---|
| public T clamp(float min, float max) Clamps this vector's length to given min and max values
| |
| cpy | back to summary |
|---|---|
public T cpy()
| |
| dot | back to summary |
|---|---|
public float dot(T v)
| |
| dst | back to summary |
|---|---|
public float dst(T v)
| |
| dst2 | back to summary |
|---|---|
| public float dst2(T v) This method is faster than
| |
| epsilonEquals | back to summary |
|---|---|
| public boolean epsilonEquals(T other, float epsilon) Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.
| |
| hasOppositeDirection | back to summary |
|---|---|
public boolean hasOppositeDirection(T other)
| |
| hasSameDirection | back to summary |
|---|---|
public boolean hasSameDirection(T other)
| |
| interpolate | back to summary |
|---|---|
| public T interpolate(T target, float alpha, Interpolation interpolator) Interpolates between this vector and the given target vector by alpha (within range [0,1]) using the given Interpolation method. the result is stored in this vector.
| |
| isCollinear | back to summary |
|---|---|
public boolean isCollinear(T other, float epsilon)
| |
| isCollinear | back to summary |
|---|---|
public boolean isCollinear(T other)
| |
| isCollinearOpposite | back to summary |
|---|---|
public boolean isCollinearOpposite(T other, float epsilon)
| |
| isCollinearOpposite | back to summary |
|---|---|
public boolean isCollinearOpposite(T other)
| |
| isOnLine | back to summary |
|---|---|
public boolean isOnLine(T other, float epsilon)
| |
| isOnLine | back to summary |
|---|---|
public boolean isOnLine(T other)
| |
| isPerpendicular | back to summary |
|---|---|
public boolean isPerpendicular(T other)
| |
| isPerpendicular | back to summary |
|---|---|
public boolean isPerpendicular(T other, float epsilon)
| |
| isUnit | back to summary |
|---|---|
public boolean isUnit()
| |
| isUnit | back to summary |
|---|---|
public boolean isUnit(final float margin)
| |
| isZero | back to summary |
|---|---|
public boolean isZero()
| |
| isZero | back to summary |
|---|---|
public boolean isZero(final float margin)
| |
| len | back to summary |
|---|---|
public float len()
| |
| len2 | back to summary |
|---|---|
| public float len2() This method is faster than
| |
| lerp | back to summary |
|---|---|
| public T lerp(T target, float alpha) Linearly interpolates between this vector and the target vector by alpha which is in the range [0,1]. The result is stored in this vector.
| |
| limit | back to summary |
|---|---|
| public T limit(float limit) Limits the length of this vector, based on the desired maximum length.
| |
| limit2 | back to summary |
|---|---|
| public T limit2(float limit2) Limits the length of this vector, based on the desired maximum length squared. This method is slightly faster than limit().
| |
| mulAdd | back to summary |
|---|---|
| public T mulAdd(T v, float scalar) First scale a supplied vector, then add it to this vector.
| |
| mulAdd | back to summary |
|---|---|
| public T mulAdd(T v, T mulVec) First scale a supplied vector, then add it to this vector.
| |
| nor | back to summary |
|---|---|
| public T nor() Normalizes this vector. Does nothing if it is zero.
| |
| scl | back to summary |
|---|---|
| public T scl(float scalar) Scales this vector by a scalar
| |
| scl | back to summary |
|---|---|
| public T scl(T v) Scales this vector by another vector
| |
| set | back to summary |
|---|---|
| public T set(T v) Sets this vector from the given vector
| |
| setLength | back to summary |
|---|---|
| public T setLength(float len) Sets the length of this vector. Does nothing if this vector is zero.
| |
| setLength2 | back to summary |
|---|---|
| public T setLength2(float len2) Sets the length of this vector, based on the square of the desired length. Does nothing if this vector is zero. This method is slightly faster than setLength().
| |
| setToRandomDirection | back to summary |
|---|---|
| public T setToRandomDirection() Sets this vector to the unit vector with a random direction
| |
| setZero | back to summary |
|---|---|
| public T setZero() Sets the components of this vector to 0
| |
| sub | back to summary |
|---|---|
| public T sub(T v) Subtracts the given vector from this vector.
| |