Added default weight attribute

pull/35/head
James Ball 2020-02-12 16:19:27 +00:00
rodzic 6c6616999a
commit a6c1335ef2
5 zmienionych plików z 7 dodań i 6 usunięć

Wyświetl plik

@ -12,7 +12,7 @@ public class AudioClient {
public static void main(String[] args) throws InterruptedException {
AudioPlayer player = new AudioPlayer(SAMPLE_RATE, 440);
Camera camera = new Camera(0.6, new Vector3(0, 0, -3));
Camera camera = new Camera(0.6, new Vector3(0, 0, -2));
WorldObject cube = new WorldObject(args[0], new Vector3(0, 0, 0), new Vector3());
Vector3 rotation = new Vector3(0,Math.PI / 100,Math.PI / 100);

Wyświetl plik

@ -17,11 +17,11 @@ public class Ellipse extends Shape {
}
public Ellipse(double a, double b, Vector2 position) {
this(a, b, 100, 0, position);
this(a, b, Shape.DEFAULT_WEIGHT, 0, position);
}
public Ellipse(double a, double b) {
this(a, b, 100, 0, new Vector2());
this(a, b, Shape.DEFAULT_WEIGHT, 0, new Vector2());
}
@Override

Wyświetl plik

@ -4,8 +4,6 @@ public class Line extends Shape {
private final Vector2 a;
private final Vector2 b;
public static final double DEFAULT_WEIGHT = 100;
public Line(Vector2 a, Vector2 b, double weight) {
this.a = a;
this.b = b;
@ -14,7 +12,7 @@ public class Line extends Shape {
}
public Line(Vector2 a, Vector2 b) {
this(a, b, DEFAULT_WEIGHT);
this(a, b, Shape.DEFAULT_WEIGHT);
}
public Line(double x1, double y1, double x2, double y2, double weight) {

Wyświetl plik

@ -1,6 +1,8 @@
package shapes;
public abstract class Shape {
public static final int DEFAULT_WEIGHT = 100;
protected double weight;
protected double length;

Wyświetl plik

@ -11,6 +11,7 @@ public class Vector2 extends Shape{
public Vector2(double x, double y) {
this.x = x;
this.y = y;
this.weight = Shape.DEFAULT_WEIGHT;
}
public Vector2() {