Kleinere bugfixes

This commit is contained in:
ngb
2022-01-02 22:15:07 +01:00
parent 01c216e216
commit 6275593eb3

View File

@@ -15,19 +15,14 @@ public class Vector extends Point2D.Double {
y = 0.0;
}
public Vector( double x, double pY ) {
public Vector( double x, double y ) {
this.x = x;
y = pY;
this.y = y;
}
public Vector( Point2D point ) {
x = point.getX();
x = point.getY();
}
public Vector( Vector vec ) {
x = vec.x;
y = vec.y;
y = point.getY();
}
public static Vector random() {
@@ -38,6 +33,10 @@ public class Vector extends Point2D.Double {
return new Vector(Math.random() * (max - min) + min, Math.random() * (max - min) + min);
}
public static Vector random( double minX, double maxX, double minY, double maxY ) {
return new Vector(Math.random() * (maxX - minX) + minX, Math.random() * (maxY - minY) + minY);
}
public static Vector setLength( Vector vector, double length ) {
Vector vec = vector.copy();
vec.setLen(length);