1 package com.irtimaled.bbor.common.models;
3 import com.irtimaled.bbor.common.TypeHelper;
6 private final double x;
7 private final double y;
8 private final double z;
10 public Point(double x, double y, double z) {
16 public Point(Coords Coords) {
17 this.x = Coords.getX();
18 this.y = Coords.getY();
19 this.z = Coords.getZ();
22 public double getX() {
26 public double getY() {
30 public double getZ() {
34 public Point offset(double x, double y, double z) {
35 return new Point(this.x + x, this.y + y, this.z + z);
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);
45 public Coords getCoords() {
46 return new Coords(x, y, z);
50 public int hashCode() {
51 return TypeHelper.combineHashCodes(Double.hashCode(z), Double.hashCode(y), Double.hashCode(x));
55 public boolean equals(Object obj) {
56 if (this == obj) return true;
57 if (obj == null || getClass() != obj.getClass()) return false;
58 Point point = (Point) obj;
59 return getX() == point.getX() && getY() == point.getY() && getZ() == point.getZ();