Package buildengine.math.vector
Class Vector2i
java.lang.Object
buildengine.math.vector.Vector2i
2D Vector with int point coordinates
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(int d) add
(int x, int y) clone()
dev
(int d) dev
(int x, int y) int
boolean
flip()
int
int
getX()
int
getY()
int
length()
mul
(int d) mul
(int x, int y) set
(int x, int y) Changes the components of the vectorvoid
setX
(int x) void
setY
(int y) sub
(int d) sub
(int x, int y) toString()
static Vector2i
valueOf
(int[] ints) static Vector2i
-
Field Details
-
x
public int xThe components of the vector -
y
public int yThe components of the vector
-
-
Constructor Details
-
Vector2i
public Vector2i()Creates a new vector with both components set to 0 -
Vector2i
-
Vector2i
-
Vector2i
public Vector2i(int d) Creates a new vector with equal components- Parameters:
d
- both components value
-
Vector2i
public Vector2i(int x, int 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
-
dev
-
dev
-
dev
-
dev
-
dev
-
dev
-
dot
-
flip
-
flip
-
normalize
-
normalize
-
length
public int length() -
getRadians
public int getRadians() -
getPerpendicular
-
getX
public int getX() -
getY
public int getY() -
setX
public void setX(int x) -
setY
public void setY(int y) -
valueOf
-
valueOf
-
equals
-
toString
-
clone
-