public final class Vec2d extends Object
| Constructor and Description |
|---|
Vec2d()
Construct instance with x = 0, y = 0.
|
Vec2d(double x,
double y)
Construct instance with (x, y) values set to passed parameters.
|
Vec2d(Vec2d v)
Constructs instance with values from the input vector 'v'.
|
| Modifier and Type | Method and Description |
|---|---|
Vec2d |
add(double x,
double y)
Adds the given values to this vector.
|
Vec2d |
add(Vec2d v)
Adds the given vector 'v' to this vector.
|
Vec2d |
scale(double scalar)
Scales this vector's values by a constant.
|
Vec2d |
set(double x,
double y)
Set the x and y values of this vector.
|
Vec2d |
set(Vec2d v)
Set the x and y values of this vector to match input vector 'v'.
|
Vec2d |
sub(double x,
double y)
Subtracts the given values from this vector.
|
Vec2d |
sub(Vec2d v)
Subtracts the given vector 'v' from this vector.
|
String |
toString() |
public Vec2d()
public Vec2d(double x,
double y)
x - value in xy - value in ypublic Vec2d(Vec2d v)
v - The vectorpublic Vec2d set(double x, double y)
x - value in xy - value in ypublic Vec2d set(Vec2d v)
v - contains values to copypublic Vec2d add(double x, double y)
x - value in xy - value in ypublic Vec2d add(Vec2d v)
v - vector to addpublic Vec2d sub(double x, double y)
x - value in x to subtracty - value in y to subtractpublic Vec2d sub(Vec2d v)
v - vector to subtractpublic Vec2d scale(double scalar)
scalar - constant to scale this vector's values byCopyright © 2022. All rights reserved.