source: lost-haven/main/Point.java@ 4d8825f

Last change on this file since 4d8825f was 8edd04e, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 4 years ago

Make the decompiled game code compile successfully

  • Property mode set to 100644
File size: 1.5 KB
Line 
1package main;
2
3public class Point {
4
5 private int x;
6 private int xMin;
7 private int y;
8 private int yMin;
9
10 public Point() {
11 this.x = 0;
12 this.y = 0;
13 }
14
15 public Point(int x, int y) {
16 this.x = x;
17 this.xMin = 0;
18 this.y = y;
19 this.yMin = 0;
20 }
21
22 public Point(int x, int xMin, int y, int yMin) {
23 this.x = x;
24 this.xMin = xMin;
25 this.y = y;
26 this.yMin = yMin;
27 }
28
29 public Point(Point p) {
30 this.x = p.x;
31 this.xMin = p.xMin;
32 this.y = p.y;
33 this.yMin = p.yMin;
34 }
35
36 public int getX() {
37 return this.x;
38 }
39
40 public int getXMin() {
41 return this.xMin;
42 }
43
44 public int getY() {
45 return this.y;
46 }
47
48 public int getYMin() {
49 return this.yMin;
50 }
51
52 public void setX(int x) {
53 this.x = x;
54 }
55
56 public void setXMin(int xMin) {
57 this.xMin = xMin;
58 }
59
60 public void setY(int y) {
61 this.y = y;
62 }
63
64 public void setYMin(int yMin) {
65 this.yMin = yMin;
66 }
67
68 public boolean equals(Point p) {
69 return (this.x == p.x && this.y == p.y && this.xMin == p.xMin && this.yMin == p.yMin);
70 }
71
72 public String toString() {
73 return String.valueOf(this.x) + "," + this.y;
74 }
75
76 public static int xDif(Point p1, Point p2) {
77 return 100 * (p2.x - p1.x) + p2.xMin - p1.xMin;
78 }
79
80 public static int yDif(Point p1, Point p2) {
81 return 100 * (p2.y - p1.y) + p2.yMin - p1.yMin;
82 }
83
84 public static double dist(Point p1, Point p2) {
85 return Math.sqrt(Math.pow((p1.x + p1.xMin / 100 - p2.x - p2.xMin / 100), 2.0D) + Math.pow((p1.y + p1.yMin / 100 - p2.y - p2.yMin / 100), 2.0D));
86 }
87}
Note: See TracBrowser for help on using the repository browser.