Simplify constructors and improve constants

pull/35/head
James Ball 2020-11-02 22:11:23 +00:00
rodzic 1081562cfb
commit cd2d1925b1
2 zmienionych plików z 12 dodań i 9 usunięć

Wyświetl plik

@ -15,9 +15,10 @@ public class Camera {
private static final double VERTEX_VALUE_THRESHOLD = 1;
private static final double CAMERA_MOVE_INCREMENT = -0.1;
private static final int SAMPLE_RENDER_SAMPLES = 50;
private static final double EPSILON = 0.001;
private final double focalLength;
private double focalLength;
private double clipping = 0.001;
private Vector3 pos;
public Camera(double focalLength, Vector3 pos) {
@ -100,7 +101,7 @@ public class Camera {
}
private Vector2 project(Vector3 vertex) {
if (vertex.getZ() - pos.getZ() < clipping) {
if (vertex.getZ() - pos.getZ() < EPSILON) {
return new Vector2();
}

Wyświetl plik

@ -6,18 +6,20 @@ public final class Vector3 {
private final double x, y, z;
public Vector3() {
this.x = 0;
this.y = 0;
this.z = 0;
}
public Vector3(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
public Vector3(double xyz) {
this(xyz, xyz, xyz);
}
public Vector3() {
this(0, 0, 0);
}
public double getX() {
return x;
}