org.jsfml.system

Class Vector3f

• All Implemented Interfaces:
Serializable

public final class Vector3f
extends Object
implements Serializable
Represents three-dimensional vectors using floating point coordinates and provides arithmetic operations on floating point 3D vectors.
Serialized Form
• Field Detail

• ZERO

public static final Vector3f ZERO
The zero vector.
• x

public final float x
The vector's X coordinate.
• y

public final float y
The vector's Y coordinate.
• z

public final float z
The vector's Z coordinate.
• Constructor Detail

• Vector3f

public Vector3f(float x,
float y,
float z)
Constructs a new vector with the given coordinates.
Parameters:
x - the X coordinate.
y - the Y coordinate.
z - the Z coordinate.
• Vector3f

public Vector3f(Vector3i v)
Constructs a new vector by converting an integral vector.

The fractions of the coordinates will be zero.

Parameters:
v - the vector to convert.
• Method Detail

public static Vector3f add(Vector3f a,
Vector3f b)
Parameters:
a - the first vector.
b - the second vector.
Returns:
a new vector, representing the sum of the two vectors.
• sub

public static Vector3f sub(Vector3f a,
Vector3f b)
Subtracts two vectors.
Parameters:
a - the first vector.
b - the second vector.
Returns:
a new vector, representing the difference between the two vectors.
• componentwiseMul

public static Vector3f componentwiseMul(Vector3f a,
Vector3f b)
Performs a component-wise multiplication of two vectors.
Parameters:
a - the first vector.
b - the second vector.
Returns:
a new vector, representing the "product" of the two vectors.
• componentwiseDiv

public static Vector3f componentwiseDiv(Vector3f a,
Vector3f b)
Performs a component-wise division of two vectors.
Parameters:
a - the first vector.
b - the second vector.
Returns:
a new vector, representing the "quotient" of the two vectors.
• mul

public static Vector3f mul(Vector3f a,
float s)
Multiplies a vector by a scalar.
Parameters:
a - the vector.
s - the scalar to multiply by.
Returns:
a new vector, representing the scaled vector.
• div

public static Vector3f div(Vector3f a,
float s)
Multiplies a vector by the inverse of a scalar.
Parameters:
a - the vector.
s - the scalar to divide by.
Returns:
a new vector, representing the scaled vector.
• neg

public static Vector3f neg(Vector3f v)
Computes the negation of a vector.
Parameters:
v - the vector.
Returns:
a new vector, representing the negation of the given vector.
• hashCode

public int hashCode()
Overrides:
hashCode in class Object