Package rosequartz.math
Class Vec2
- All Implemented Interfaces:
Serializable
Represents a vector with an x- and a y-component.
- See Also:
- Serialized Form
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected float[]Returns an array containing all components in the order they appear in the vector.protected Vec2Creates a new vector (values don't matter) of this type.set(float x, float y)Sets the vector to the given values.Sets the vector to the given values.protected voidsetComponents(float[] values)Sets the components of the vector.
-
Field Details
-
x
public float x -
y
public float y
-
-
Constructor Details
-
Vec2
public Vec2()Create a vector initialized to [0, 0]. -
Vec2
Creates a vector with the given values. -
Vec2
public Vec2(float x, float y)Creates a vector with the given values.
-
-
Method Details
-
set
Sets the vector to the given values.- Returns:
- this
-
set
Sets the vector to the given values.- Returns:
- this
-
getComponents
protected float[] getComponents()Description copied from class:VecReturns an array containing all components in the order they appear in the vector.- Specified by:
getComponentsin classVec<Vec2>- Returns:
- array containing all vector components
-
setComponents
protected void setComponents(float[] values)Description copied from class:VecSets the components of the vector.- Specified by:
setComponentsin classVec<Vec2>- Parameters:
values- an array containing the values for all components.
-
getNewVector
Description copied from class:VecCreates a new vector (values don't matter) of this type.- Specified by:
getNewVectorin classVec<Vec2>- Returns:
- new vector of this type
-