]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/client/models/Point.java
Move config to client module
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / models / Point.java
1 package com.irtimaled.bbor.client.models;
2
3 import com.irtimaled.bbor.common.models.Coords;
4
5 public class Point {
6     private final double x;
7     private final double y;
8     private final double z;
9
10     public Point(double x, double y, double z) {
11         this.x = x;
12         this.y = y;
13         this.z = z;
14     }
15
16     public Point(Coords Coords) {
17         this.x = Coords.getX();
18         this.y = Coords.getY();
19         this.z = Coords.getZ();
20     }
21
22     public double getX() {
23         return x;
24     }
25
26     public double getY() {
27         return y;
28     }
29
30     public double getZ() {
31         return z;
32     }
33
34     public Point offset(double x, double y, double z) {
35         return new Point(this.x + x, this.y + y, this.z + z);
36     }
37
38     public double getDistance(Point point) {
39         double dx = this.x - point.x;
40         double dy = this.y - point.y;
41         double dz = this.z - point.z;
42         return Math.sqrt(dx * dx + dy * dy + dz * dz);
43     }
44
45     public Coords getCoords() {
46         return new Coords(x, y, z);
47     }
48 }