APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.math

public Class Vector4

extends Object
implements Serializable, Vector<Vector4>
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.math.Vector, java.io.Serializable
Imports
com.badlogic.gdx.utils.GdxRuntimeException, .NumberUtils, java.io.Serializable

Encapsulates a 4D vector. Allows chaining operations by returning a reference to itself in all modification methods.
Authors
[email protected], Antz

Field Summary

Modifier and TypeField and Description
public static final Vector4
private static final long
public float
w

the w-component of this vector

public static final Vector4
W

public float
x

the x-component of this vector

public static final Vector4
X

public float
y

the y-component of this vector

public static final Vector4
Y

public float
z

the z-component of this vector

public static final Vector4
Z

public static final Vector4

Constructor Summary

AccessConstructor and Description
public
Vector4()

Constructs a vector at (0,0,0,0)

public
Vector4(float
The x-component
x
,
float
The y-component
y
,
float
The z-component
z
,
float
The w-component *
w
)

Creates a vector with the given components

public
Vector4(final Vector4
The vector
vector
)

Creates a vector from the given Vector4

public
Vector4(final float[]
The array
values
)

Creates a vector from the given array.

public
Vector4(final Vector2
The vector
vector
,
float
The z-component
z
,
float
The w-component
w
)

Creates a vector from the given Vector2 and z- and w-components

public
Vector4(final Vector3
The vector
vector
,
float
The w-component
w
)

Creates a vector from the given Vector3 and w-component

Method Summary

Modifier and TypeMethod and Description
public Vector4
add(final Vector4 vector)

Implements com.badlogic.gdx.math.Vector.add.

Adds the given vector to this vector

public Vector4

Returns:

This vector for chaining.
add
(float
Added to the x-component
x
,
float
Added to the y-component
y
,
float
Added to the z-component
z
,
float
Added to the w-component
w
)

Adds the given components to this vector

public Vector4

Returns:

This vector for chaining
add
(float
The value
values
)

Implements com.badlogic.gdx.math.Vector.add.

Adds the given value to all four components of the vector.

public Vector4
clamp(float min, float max)

Implements com.badlogic.gdx.math.Vector.clamp.

Clamps this vector's length to given min and max values

public Vector4
public static float
dot(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2)

Returns: The dot product between the two vectors

public float
dot(final Vector4 vector)

Implements com.badlogic.gdx.math.Vector.dot.

public float

Returns:

The dot product
dot
(float
The x-component of the other vector
x
,
float
The y-component of the other vector
y
,
float
The z-component of the other vector
z
,
float
The w-component of the other vector
w
)

Returns the dot product between this and the given vector (given as 4 components).

public static float
dst(final float x1, final float y1, final float z1, final float w1, final float x2, final float y2, final float z2, final float w2)

Returns: The Euclidean distance between the two specified vectors

public float
dst(final Vector4 vector)

Implements com.badlogic.gdx.math.Vector.dst.

public float
dst(float x, float y, float z, float w)

Returns: the distance between this point and the given point

public static float
dst2(final float x1, final float y1, final float z1, final float w1, final float x2, final float y2, final float z2, final float w2)

Returns: the squared distance between the given points

public float
dst2(Vector4 point)

Implements com.badlogic.gdx.math.Vector.dst2.

This method is faster than Vector#dst(Vector) because it avoids calculating a square root.

public float

Returns:

The squared distance
dst2
(float
The x-component of the other point
x
,
float
The y-component of the other point
y
,
float
The z-component of the other point
z
,
float
The w-component of the other point
w
)

Returns the squared distance between this point and the given point

public boolean
epsilonEquals(final Vector4 other, float epsilon)

Implements com.badlogic.gdx.math.Vector.epsilonEquals.

Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.

public boolean

Returns:

whether the vectors are the same.
epsilonEquals
(float
x component of the other vector to compare
x
,
float
y component of the other vector to compare
y
,
float
z component of the other vector to compare
z
,
float
w component of the other vector to compare
w
,
float
how much error to tolerate and still consider two floats equal
epsilon
)

Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.

public boolean

Returns:

true if the vectors are equal, otherwise false
epsilonEquals
(final Vector4
other vector to compare
other
)

Compares this vector with the other vector using MathUtils#FLOAT_ROUNDING_ERROR for its epsilon.

public boolean

Returns:

true if the vectors are equal, otherwise false
epsilonEquals
(float
x component of the other vector to compare
x
,
float
y component of the other vector to compare
y
,
float
z component of the other vector to compare
z
,
float
w component of the other vector to compare
w
)

Compares this vector with the other vector using MathUtils#FLOAT_ROUNDING_ERROR for its epsilon.

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public Vector4

Returns:

this vector, set with the value from v, for chaining
fromString
(String
the string.
v
)

Sets this Vector4 to the value represented by the specified string according to the format of toString().

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
public boolean
public boolean

Returns:

Whether this and the other vector are equal with exact precision
idt
(final Vector4
The other vector
vector
)

Returns true if this vector and the vector parameter have identical components.

public Vector4
interpolate(Vector4 target, float alpha, Interpolation interpolator)

Implements com.badlogic.gdx.math.Vector.interpolate.

Interpolates between this vector and the given target vector by alpha (within range [0,1]) using the given Interpolation method.

public boolean
isCollinear(Vector4 other, float epsilon)

Implements com.badlogic.gdx.math.Vector.isCollinear.

Returns: true if this vector is collinear with the other vector (isOnLine(Vector4, float) && hasSameDirection(Vector4)).

public boolean
isCollinear(Vector4 other)

Implements com.badlogic.gdx.math.Vector.isCollinear.

Returns: true if this vector is collinear with the other vector (isOnLine(Vector4) && hasSameDirection(Vector4)).

public boolean
isCollinearOpposite(Vector4 other, float epsilon)

Implements com.badlogic.gdx.math.Vector.isCollinearOpposite.

Returns: true if this vector is collinear with the other vector (isOnLine(Vector4, float) && hasSameDirection(Vector4)).

public boolean
isCollinearOpposite(Vector4 other)

Implements com.badlogic.gdx.math.Vector.isCollinearOpposite.

Returns: true if this vector is collinear with the other vector (isOnLine(Vector4) && hasSameDirection(Vector4)).

public boolean
isOnLine(Vector4 other, float epsilon)

Implements com.badlogic.gdx.math.Vector.isOnLine.

Returns: true if this vector is in line with the other vector (either in the same or the opposite direction)

public boolean
isOnLine(Vector4 other)

Implements com.badlogic.gdx.math.Vector.isOnLine.

Returns: true if this vector is in line with the other vector (either in the same or the opposite direction)

public boolean
public boolean
public boolean
public boolean
isUnit(final float margin)

Implements com.badlogic.gdx.math.Vector.isUnit.

public boolean
public boolean
isZero(final float margin)

Implements com.badlogic.gdx.math.Vector.isZero.

public static float
len(final float x, final float y, final float z, float w)

Returns: The Euclidean length

public float
public static float
len2(final float x, final float y, final float z, float w)

Returns: The squared Euclidean length

public float
len2()

Implements com.badlogic.gdx.math.Vector.len2.

This method is faster than Vector#len() because it avoids calculating a square root.

public Vector4
lerp(final Vector4 target, float alpha)

Implements com.badlogic.gdx.math.Vector.lerp.

Linearly interpolates between this vector and the target vector by alpha which is in the range [0,1].

public Vector4
limit(float limit)

Implements com.badlogic.gdx.math.Vector.limit.

Limits the length of this vector, based on the desired maximum length.

public Vector4
limit2(float limit2)

Implements com.badlogic.gdx.math.Vector.limit2.

Limits the length of this vector, based on the desired maximum length squared.

public Vector4
mulAdd(Vector4 vec, float scalar)

Implements com.badlogic.gdx.math.Vector.mulAdd, com.badlogic.gdx.math.Vector.mulAdd.

First scale a supplied vector, then add it to this vector.

public Vector4
mulAdd(Vector4 vec, Vector4 mulVec)

Implements com.badlogic.gdx.math.Vector.mulAdd.

First scale a supplied vector, then add it to this vector.

public Vector4
nor()

Implements com.badlogic.gdx.math.Vector.nor.

Normalizes this vector.

public Vector4

Returns:

This vector for chaining
scl
(float
Each component will be multiplied by this float
scalar
)

Implements com.badlogic.gdx.math.Vector.scl, com.badlogic.gdx.math.Vector.scl.

Multiplies each component of this vector by the given scalar

public Vector4

Returns:

This vector for chaining
scl
(final Vector4
Another Vector4 that will be used to scale this
other
)

Implements com.badlogic.gdx.math.Vector.scl.

Multiplies each component of this vector by the corresponding component in other

public Vector4

Returns:

This vector for chaining
scl
(float
Multiplied with the X value
vx
,
float
Multiplied with the Y value
vy
,
float
Multiplied with the Z value
vz
,
float
Multiplied with the W value
vw
)

Scales this vector by the given values

public Vector4

Returns:

this vector for chaining
set
(float
The x-component
x
,
float
The y-component
y
,
float
The z-component
z
,
float
The w-component
w
)

Sets the vector to the given components

public Vector4
set(final Vector4 vector)

Implements com.badlogic.gdx.math.Vector.set.

Sets this vector from the given vector

public Vector4

Returns:

this vector for chaining
set
(final float[]
The array
values
)

Implements com.badlogic.gdx.math.Vector.set.

Sets the components from the array.

public Vector4

Returns:

This vector for chaining
set
(final Vector2
The vector2 holding the x- and y-components
vector
,
float
The z-component
z
,
float
The w-component
w
)

Sets the components to the given Vector2, z-component and w-component

public Vector4

Returns:

This vector for chaining
set
(final Vector3
The vector
vector
,
float
The w-component
w
)

Sets the components of the given vector3 and w-component

public Vector4
setLength(float len)

Implements com.badlogic.gdx.math.Vector.setLength.

Sets the length of this vector.

public Vector4
setLength2(float len2)

Implements com.badlogic.gdx.math.Vector.setLength2.

Sets the length of this vector, based on the square of the desired length.

public Vector4
setToRandomDirection()

Implements com.badlogic.gdx.math.Vector.setToRandomDirection.

Sets this vector to the unit vector with a random direction

public Vector4
setZero()

Implements com.badlogic.gdx.math.Vector.setZero.

Sets the components of this vector to 0

public Vector4
sub(final Vector4 a_vec)

Implements com.badlogic.gdx.math.Vector.sub.

Subtracts the given vector from this vector.

public Vector4

Returns:

This vector for chaining
sub
(float
Subtracted from the x-component
x
,
float
Subtracted from the y-component
y
,
float
Subtracted from the z-component
z
,
float
Subtracted from the w-component
w
)

Subtracts the given components from this vector.

public Vector4

Returns:

This vector for chaining
sub
(float
The value
value
)

Implements com.badlogic.gdx.math.Vector.sub.

Subtracts the given value from all components of this vector

public String

Returns:

a string representation of this object.
toString
()

Overrides java.lang.Object.toString.

Converts this Vector4 to a string in the format (x,y,z,w).

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

Oneback to summary
public static final Vector4 One
serialVersionUIDback to summary
private static final long serialVersionUID
wback to summary
public float w

the w-component of this vector

Wback to summary
public static final Vector4 W
xback to summary
public float x

the x-component of this vector

Xback to summary
public static final Vector4 X
yback to summary
public float y

the y-component of this vector

Yback to summary
public static final Vector4 Y
zback to summary
public float z

the z-component of this vector

Zback to summary
public static final Vector4 Z
Zeroback to summary
public static final Vector4 Zero

Constructor Detail

Vector4back to summary
public Vector4()

Constructs a vector at (0,0,0,0)

Vector4back to summary
public Vector4(float x, float y, float z, float w)

Creates a vector with the given components

Parameters
x:float

The x-component

y:float

The y-component

z:float

The z-component

w:float

The w-component *

Vector4back to summary
public Vector4(final Vector4 vector)

Creates a vector from the given Vector4

Parameters
vector:Vector4

The vector

Vector4back to summary
public Vector4(final float[] values)

Creates a vector from the given array. The array must have at least 4 elements.

Parameters
values:float[]

The array

Vector4back to summary
public Vector4(final Vector2 vector, float z, float w)

Creates a vector from the given Vector2 and z- and w-components

Parameters
vector:Vector2

The vector

z:float

The z-component

w:float

The w-component

Vector4back to summary
public Vector4(final Vector3 vector, float w)

Creates a vector from the given Vector3 and w-component

Parameters
vector:Vector3

The vector

w:float

The w-component

Method Detail

addback to summary
public Vector4 add(final Vector4 vector)

Implements com.badlogic.gdx.math.Vector.add.

Doc from com.badlogic.gdx.math.Vector.add.

Adds the given vector to this vector

Annotations
@Override
addback to summary
public Vector4 add(float x, float y, float z, float w)

Adds the given components to this vector

Parameters
x:float

Added to the x-component

y:float

Added to the y-component

z:float

Added to the z-component

w:float

Added to the w-component

Returns:Vector4

This vector for chaining.

addback to summary
public Vector4 add(float values)

Implements com.badlogic.gdx.math.Vector.add.

Adds the given value to all four components of the vector.

Parameters
values:float

The value

Returns:Vector4

This vector for chaining

clampback to summary
public Vector4 clamp(float min, float max)

Implements com.badlogic.gdx.math.Vector.clamp.

Doc from com.badlogic.gdx.math.Vector.clamp.

Clamps this vector's length to given min and max values

Annotations
@Override
cpyback to summary
public Vector4 cpy()

Implements com.badlogic.gdx.math.Vector.cpy.

Annotations
@Override
dotback to summary
public static float dot(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2)
Returns:float

The dot product between the two vectors

dotback to summary
public float dot(final Vector4 vector)

Implements com.badlogic.gdx.math.Vector.dot.

Annotations
@Override
dotback to summary
public float dot(float x, float y, float z, float w)

Returns the dot product between this and the given vector (given as 4 components).

Parameters
x:float

The x-component of the other vector

y:float

The y-component of the other vector

z:float

The z-component of the other vector

w:float

The w-component of the other vector

Returns:float

The dot product

dstback to summary
public static float dst(final float x1, final float y1, final float z1, final float w1, final float x2, final float y2, final float z2, final float w2)
Returns:float

The Euclidean distance between the two specified vectors

dstback to summary
public float dst(final Vector4 vector)

Implements com.badlogic.gdx.math.Vector.dst.

Annotations
@Override
dstback to summary
public float dst(float x, float y, float z, float w)
Returns:float

the distance between this point and the given point

dst2back to summary
public static float dst2(final float x1, final float y1, final float z1, final float w1, final float x2, final float y2, final float z2, final float w2)
Returns:float

the squared distance between the given points

dst2back to summary
public float dst2(Vector4 point)

Implements com.badlogic.gdx.math.Vector.dst2.

Doc from com.badlogic.gdx.math.Vector.dst2.

This method is faster than Vector#dst(Vector) because it avoids calculating a square root. It is useful for comparisons, but not for getting accurate distances, as the return value is the square of the actual distance.

Annotations
@Override
dst2back to summary
public float dst2(float x, float y, float z, float w)

Returns the squared distance between this point and the given point

Parameters
x:float

The x-component of the other point

y:float

The y-component of the other point

z:float

The z-component of the other point

w:float

The w-component of the other point

Returns:float

The squared distance

epsilonEqualsback to summary
public boolean epsilonEquals(final Vector4 other, float epsilon)

Implements com.badlogic.gdx.math.Vector.epsilonEquals.

Doc from com.badlogic.gdx.math.Vector.epsilonEquals.

Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.

Annotations
@Override
epsilonEqualsback to summary
public boolean epsilonEquals(float x, float y, float z, float w, float epsilon)

Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.

Parameters
x:float

x component of the other vector to compare

y:float

y component of the other vector to compare

z:float

z component of the other vector to compare

w:float

w component of the other vector to compare

epsilon:float

how much error to tolerate and still consider two floats equal

Returns:boolean

whether the vectors are the same.

epsilonEqualsback to summary
public boolean epsilonEquals(final Vector4 other)

Compares this vector with the other vector using MathUtils#FLOAT_ROUNDING_ERROR for its epsilon.

Parameters
other:Vector4

other vector to compare

Returns:boolean

true if the vectors are equal, otherwise false

epsilonEqualsback to summary
public boolean epsilonEquals(float x, float y, float z, float w)

Compares this vector with the other vector using MathUtils#FLOAT_ROUNDING_ERROR for its epsilon.

Parameters
x:float

x component of the other vector to compare

y:float

y component of the other vector to compare

z:float

z component of the other vector to compare

w:float

w component of the other vector to compare

Returns:boolean

true if the vectors are equal, otherwise false

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
fromStringback to summary
public Vector4 fromString(String v)

Sets this Vector4 to the value represented by the specified string according to the format of toString().

Parameters
v:String

the string.

Returns:Vector4

this vector, set with the value from v, for chaining

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
hasOppositeDirectionback to summary
public boolean hasOppositeDirection(Vector4 vector)

Implements com.badlogic.gdx.math.Vector.hasOppositeDirection.

Annotations
@Override
hasSameDirectionback to summary
public boolean hasSameDirection(Vector4 vector)

Implements com.badlogic.gdx.math.Vector.hasSameDirection.

Annotations
@Override
idtback to summary
public boolean idt(final Vector4 vector)

Returns true if this vector and the vector parameter have identical components.

Parameters
vector:Vector4

The other vector

Returns:boolean

Whether this and the other vector are equal with exact precision

interpolateback to summary
public Vector4 interpolate(Vector4 target, float alpha, Interpolation interpolator)

Implements com.badlogic.gdx.math.Vector.interpolate.

Doc from com.badlogic.gdx.math.Vector.interpolate.

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.

Annotations
@Override
isCollinearback to summary
public boolean isCollinear(Vector4 other, float epsilon)

Implements com.badlogic.gdx.math.Vector.isCollinear.

Returns:boolean

true if this vector is collinear with the other vector (isOnLine(Vector4, float) && hasSameDirection(Vector4)).

Annotations
@Override
isCollinearback to summary
public boolean isCollinear(Vector4 other)

Implements com.badlogic.gdx.math.Vector.isCollinear.

Returns:boolean

true if this vector is collinear with the other vector (isOnLine(Vector4) && hasSameDirection(Vector4)).

Annotations
@Override
isCollinearOppositeback to summary
public boolean isCollinearOpposite(Vector4 other, float epsilon)

Implements com.badlogic.gdx.math.Vector.isCollinearOpposite.

Returns:boolean

true if this vector is collinear with the other vector (isOnLine(Vector4, float) && hasSameDirection(Vector4)).

Annotations
@Override
isCollinearOppositeback to summary
public boolean isCollinearOpposite(Vector4 other)

Implements com.badlogic.gdx.math.Vector.isCollinearOpposite.

Returns:boolean

true if this vector is collinear with the other vector (isOnLine(Vector4) && hasSameDirection(Vector4)).

Annotations
@Override
isOnLineback to summary
public boolean isOnLine(Vector4 other, float epsilon)

Implements com.badlogic.gdx.math.Vector.isOnLine.

Returns:boolean

true if this vector is in line with the other vector (either in the same or the opposite direction)

Annotations
@Override
isOnLineback to summary
public boolean isOnLine(Vector4 other)

Implements com.badlogic.gdx.math.Vector.isOnLine.

Returns:boolean

true if this vector is in line with the other vector (either in the same or the opposite direction)

Annotations
@Override
isPerpendicularback to summary
public boolean isPerpendicular(Vector4 vector)

Implements com.badlogic.gdx.math.Vector.isPerpendicular.

Annotations
@Override
isPerpendicularback to summary
public boolean isPerpendicular(Vector4 vector, float epsilon)

Implements com.badlogic.gdx.math.Vector.isPerpendicular.

Annotations
@Override
isUnitback to summary
public boolean isUnit()

Implements com.badlogic.gdx.math.Vector.isUnit.

Annotations
@Override
isUnitback to summary
public boolean isUnit(final float margin)

Implements com.badlogic.gdx.math.Vector.isUnit.

Annotations
@Override
isZeroback to summary
public boolean isZero()

Implements com.badlogic.gdx.math.Vector.isZero.

Annotations
@Override
isZeroback to summary
public boolean isZero(final float margin)

Implements com.badlogic.gdx.math.Vector.isZero.

Annotations
@Override
lenback to summary
public static float len(final float x, final float y, final float z, float w)
Returns:float

The Euclidean length

lenback to summary
public float len()

Implements com.badlogic.gdx.math.Vector.len.

Annotations
@Override
len2back to summary
public static float len2(final float x, final float y, final float z, float w)
Returns:float

The squared Euclidean length

len2back to summary
public float len2()

Implements com.badlogic.gdx.math.Vector.len2.

Doc from com.badlogic.gdx.math.Vector.len2.

This method is faster than Vector#len() because it avoids calculating a square root. It is useful for comparisons, but not for getting exact lengths, as the return value is the square of the actual length.

Annotations
@Override
lerpback to summary
public Vector4 lerp(final Vector4 target, float alpha)

Implements com.badlogic.gdx.math.Vector.lerp.

Doc from com.badlogic.gdx.math.Vector.lerp.

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.

Annotations
@Override
limitback to summary
public Vector4 limit(float limit)

Implements com.badlogic.gdx.math.Vector.limit.

Doc from com.badlogic.gdx.math.Vector.limit.

Limits the length of this vector, based on the desired maximum length.

Annotations
@Override
limit2back to summary
public Vector4 limit2(float limit2)

Implements com.badlogic.gdx.math.Vector.limit2.

Doc from com.badlogic.gdx.math.Vector.limit2.

Limits the length of this vector, based on the desired maximum length squared.

This method is slightly faster than limit().

Annotations
@Override
mulAddback to summary
public Vector4 mulAdd(Vector4 vec, float scalar)

Implements com.badlogic.gdx.math.Vector.mulAdd, com.badlogic.gdx.math.Vector.mulAdd.

Doc from com.badlogic.gdx.math.Vector.mulAdd.

First scale a supplied vector, then add it to this vector.

Annotations
@Override
mulAddback to summary
public Vector4 mulAdd(Vector4 vec, Vector4 mulVec)

Implements com.badlogic.gdx.math.Vector.mulAdd.

Doc from com.badlogic.gdx.math.Vector.mulAdd.

First scale a supplied vector, then add it to this vector.

Annotations
@Override
norback to summary
public Vector4 nor()

Implements com.badlogic.gdx.math.Vector.nor.

Doc from com.badlogic.gdx.math.Vector.nor.

Normalizes this vector. Does nothing if it is zero.

Annotations
@Override
sclback to summary
public Vector4 scl(float scalar)

Implements com.badlogic.gdx.math.Vector.scl, com.badlogic.gdx.math.Vector.scl.

Multiplies each component of this vector by the given scalar

Parameters
scalar:float

Each component will be multiplied by this float

Returns:Vector4

This vector for chaining

Annotations
@Override
sclback to summary
public Vector4 scl(final Vector4 other)

Implements com.badlogic.gdx.math.Vector.scl.

Multiplies each component of this vector by the corresponding component in other

Parameters
other:Vector4

Another Vector4 that will be used to scale this

Returns:Vector4

This vector for chaining

Annotations
@Override
sclback to summary
public Vector4 scl(float vx, float vy, float vz, float vw)

Scales this vector by the given values

Parameters
vx:float

Multiplied with the X value

vy:float

Multiplied with the Y value

vz:float

Multiplied with the Z value

vw:float

Multiplied with the W value

Returns:Vector4

This vector for chaining

setback to summary
public Vector4 set(float x, float y, float z, float w)

Sets the vector to the given components

Parameters
x:float

The x-component

y:float

The y-component

z:float

The z-component

w:float

The w-component

Returns:Vector4

this vector for chaining

setback to summary
public Vector4 set(final Vector4 vector)

Implements com.badlogic.gdx.math.Vector.set.

Doc from com.badlogic.gdx.math.Vector.set.

Sets this vector from the given vector

Annotations
@Override
setback to summary
public Vector4 set(final float[] values)

Implements com.badlogic.gdx.math.Vector.set.

Sets the components from the array. The array must have at least 4 elements

Parameters
values:float[]

The array

Returns:Vector4

this vector for chaining

setback to summary
public Vector4 set(final Vector2 vector, float z, float w)

Sets the components to the given Vector2, z-component and w-component

Parameters
vector:Vector2

The vector2 holding the x- and y-components

z:float

The z-component

w:float

The w-component

Returns:Vector4

This vector for chaining

setback to summary
public Vector4 set(final Vector3 vector, float w)

Sets the components of the given vector3 and w-component

Parameters
vector:Vector3

The vector

w:float

The w-component

Returns:Vector4

This vector for chaining

setLengthback to summary
public Vector4 setLength(float len)

Implements com.badlogic.gdx.math.Vector.setLength.

Doc from com.badlogic.gdx.math.Vector.setLength.

Sets the length of this vector. Does nothing if this vector is zero.

Annotations
@Override
setLength2back to summary
public Vector4 setLength2(float len2)

Implements com.badlogic.gdx.math.Vector.setLength2.

Doc from com.badlogic.gdx.math.Vector.setLength2.

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().

Annotations
@Override
setToRandomDirectionback to summary
public Vector4 setToRandomDirection()

Implements com.badlogic.gdx.math.Vector.setToRandomDirection.

Doc from com.badlogic.gdx.math.Vector.setToRandomDirection.

Sets this vector to the unit vector with a random direction

Annotations
@Override
setZeroback to summary
public Vector4 setZero()

Implements com.badlogic.gdx.math.Vector.setZero.

Doc from com.badlogic.gdx.math.Vector.setZero.

Sets the components of this vector to 0

Annotations
@Override
subback to summary
public Vector4 sub(final Vector4 a_vec)

Implements com.badlogic.gdx.math.Vector.sub.

Doc from com.badlogic.gdx.math.Vector.sub.

Subtracts the given vector from this vector.

Annotations
@Override
subback to summary
public Vector4 sub(float x, float y, float z, float w)

Subtracts the given components from this vector.

Parameters
x:float

Subtracted from the x-component

y:float

Subtracted from the y-component

z:float

Subtracted from the z-component

w:float

Subtracted from the w-component

Returns:Vector4

This vector for chaining

subback to summary
public Vector4 sub(float value)

Implements com.badlogic.gdx.math.Vector.sub.

Subtracts the given value from all components of this vector

Parameters
value:float

The value

Returns:Vector4

This vector for chaining

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Converts this Vector4 to a string in the format (x,y,z,w). Strings with this exact format can be parsed with fromString(String).

Returns:String

a string representation of this object.

Annotations
@Override