Fix access modifier

This commit is contained in:
2021-06-30 18:44:08 +02:00
parent d0f4c848c6
commit c11b1bb1c3

View File

@ -2,18 +2,18 @@ package de.oshgnacknak.gruphi;
public class Vector { public class Vector {
double x, y; public double x, y;
public Vector(double x, double y) { public Vector(double x, double y) {
this.x = x; this.x = x;
this.y = y; this.y = y;
} }
Vector copy() { public Vector copy() {
return new Vector(x, y); return new Vector(x, y);
} }
Vector add(Vector v) { public Vector add(Vector v) {
x += v.x; x += v.x;
y += v.y; y += v.y;
return this; return this;
@ -25,7 +25,7 @@ public class Vector {
return this; return this;
} }
Vector mul(double d) { public Vector mul(double d) {
x *= d; x *= d;
y *= d; y *= d;
return this; return this;
@ -35,11 +35,11 @@ public class Vector {
return x*v.x + y*v.y; return x*v.x + y*v.y;
} }
double mag() { public double mag() {
return Math.sqrt(dot(this)); return Math.sqrt(dot(this));
} }
Vector norm() { public Vector norm() {
return mul(1 / mag()); return mul(1 / mag());
} }
@ -47,18 +47,18 @@ public class Vector {
return mul(mag/this.mag()); return mul(mag/this.mag());
} }
double dist(Vector v) { public double dist(Vector v) {
return dist(v.x, v.y); return dist(v.x, v.y);
} }
double dist(double x, double y) { public double dist(double x, double y) {
var dx = this.x - x; var dx = this.x - x;
var dy = this.y - y; var dy = this.y - y;
return Math.sqrt(dx*dx + dy*dy); return Math.sqrt(dx*dx + dy*dy);
} }
double angle() { public double angle() {
return Math.atan2(y, x); return Math.atan2(y, x);
} }
} }