diff --git a/src/engine/Camera.java b/src/engine/Camera.java index db29eb6..c5f5279 100644 --- a/src/engine/Camera.java +++ b/src/engine/Camera.java @@ -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(); } diff --git a/src/engine/Vector3.java b/src/engine/Vector3.java index 6a449bb..a71fe8c 100644 --- a/src/engine/Vector3.java +++ b/src/engine/Vector3.java @@ -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; }