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