]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blobdiff - src/main/java/com/irtimaled/bbor/client/renderers/OffsetPoint.java
Upgrade to 1.14.2
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / renderers / OffsetPoint.java
index 4184faeca35c7019c0fa9d042a3d62b7c1cde124..9d794fdf49a64c5dc058a3e8177f0eead0c85de7 100644 (file)
@@ -1,45 +1,41 @@
 package com.irtimaled.bbor.client.renderers;
 
-import com.irtimaled.bbor.client.PlayerCoords;
+import com.irtimaled.bbor.client.Camera;
 import com.irtimaled.bbor.common.models.Coords;
+import com.irtimaled.bbor.common.models.Point;
 
 class OffsetPoint {
-    private final double x;
-    private final double y;
-    private final double z;
+    private final Point point;
 
     OffsetPoint(double x, double y, double z) {
-        this.x = x;
-        this.y = y;
-        this.z = z;
+        this(new Point(x, y, z));
     }
 
-    OffsetPoint(Coords Coords) {
-        this.x = Coords.getX();
-        this.y = Coords.getY();
-        this.z = Coords.getZ();
+    OffsetPoint(Coords coords) {
+        this(new Point(coords));
+    }
+
+    OffsetPoint(Point point) {
+        this.point = point;
     }
 
     double getX() {
-        return x - PlayerCoords.getX();
+        return point.getX() - Camera.getX();
     }
 
     double getY() {
-        return y - PlayerCoords.getY();
+        return point.getY() - Camera.getY();
     }
 
     double getZ() {
-        return z - PlayerCoords.getZ();
+        return point.getZ() - Camera.getZ();
     }
 
     OffsetPoint offset(double x, double y, double z) {
-        return new OffsetPoint(this.x + x, this.y + y, this.z + z);
+        return new OffsetPoint(point.offset(x, y, z));
     }
 
-    double getDistance(OffsetPoint point) {
-        double dx = this.x - point.x;
-        double dy = this.y - point.y;
-        double dz = this.z - point.z;
-        return Math.sqrt(dx * dx + dy * dy + dz * dz);
+    double getDistance(OffsetPoint offsetPoint) {
+        return this.point.getDistance(offsetPoint.point);
     }
 }