Package buildengine.math.vector
Class Vector2f
java.lang.Object
buildengine.math.vector.Vector2f
2D Vector with float point coordinates
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(float d) add
(float x, float y) clone()
div
(float d) div
(float x, float y) float
boolean
flip()
float
float
getX()
float
getY()
float
length()
mul
(float d) mul
(float x, float y) rotate
(double theta) set
(float x, float y) Changes the components of the vectorvoid
setX
(float x) void
setY
(float y) sub
(float d) sub
(float x, float y) toString()
static Vector2f
valueOf
(float[] floats) static Vector2f
-
Field Details
-
x
public float xThe components of the vector -
y
public float yThe components of the vector
-
-
Constructor Details
-
Vector2f
public Vector2f()Creates a new vector with both components set to 0 -
Vector2f
public Vector2f(float d) Creates a new vector with equal components- Parameters:
d
- both components value
-
Vector2f
-
Vector2f
-
Vector2f
public Vector2f(float x, float y) Creates a new vector with specified components- Parameters:
x
- the x componenty
- the y component
-
-
Method Details
-
set
Changes the components of the vector- Parameters:
x
- the x componenty
- the y component- Returns:
- the current object
-
add
-
add
-
add
-
add
-
add
-
add
-
sub
-
sub
-
sub
-
sub
-
sub
-
sub
-
mul
-
mul
-
mul
-
mul
-
mul
-
mul
-
div
-
div
-
div
-
div
-
div
-
div
-
dot
-
flip
-
flip
-
normalize
-
normalize
-
rotate
-
rotate
-
length
public float length() -
getRadians
public float getRadians() -
getPerpendicular
-
getX
public float getX() -
getY
public float getY() -
setX
public void setX(float x) -
setY
public void setY(float y) -
valueOf
-
valueOf
-
equals
-
toString
-
clone
-