Last change
on this file since a5b4186 was a5b4186, checked in by dportnoy <dmp1488@…>, 18 years ago |
[svn r36] Renamed remotely
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[a5b4186] | 1 |
|
---|
| 2 | public class Point {
|
---|
| 3 | private int x;
|
---|
| 4 | private int xMin;
|
---|
| 5 | private int y;
|
---|
| 6 | private int yMin;
|
---|
| 7 |
|
---|
| 8 | public Point() {
|
---|
| 9 | x = 0;
|
---|
| 10 | y = 0;
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 | public Point(int x, int y) {
|
---|
| 14 | this.x = x;
|
---|
| 15 | this.xMin = 0;
|
---|
| 16 | this.y = y;
|
---|
| 17 | this.yMin = 0;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | public Point(int x, int xMin, int y, int yMin) {
|
---|
| 21 | this.x = x;
|
---|
| 22 | this.xMin = xMin;
|
---|
| 23 | this.y = y;
|
---|
| 24 | this.yMin = yMin;
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | public int getX() {
|
---|
| 28 | return x;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | public int getXMin() {
|
---|
| 32 | return xMin;
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | public int getY() {
|
---|
| 36 | return y;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | public int getYMin() {
|
---|
| 40 | return yMin;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | public void setX(int x) {
|
---|
| 44 | this.x = x;
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | public void setXMin(int xMin) {
|
---|
| 48 | this.xMin = xMin;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | public void setY(int y) {
|
---|
| 52 | this.y = y;
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | public void setYMin(int yMin) {
|
---|
| 56 | this.yMin = yMin;
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | public String toString() {
|
---|
| 60 | return x+","+y;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | public static int xDif(Point p1, Point p2) {
|
---|
| 64 | return 100*(p2.x-p1.x)+p2.xMin-p1.xMin;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | public static int yDif(Point p1, Point p2) {
|
---|
| 68 | return 100*(p2.y-p1.y)+p2.yMin-p1.yMin;
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | public static double dist(Point p1, Point p2) {
|
---|
| 72 | return Math.sqrt(Math.pow(p1.x+p1.xMin/100-p2.x-p2.xMin/100, 2)+Math.pow(p1.y+p1.yMin/100-p2.y-p2.yMin/100, 2));
|
---|
| 73 | }
|
---|
| 74 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.