/* */ package NET.worlds.scape; /* */ /* */ import java.io.IOException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class Point2 /* */ implements Persister /* */ { /* */ public float x; /* */ public float y; /* */ /* */ public Point2() {} /* */ /* */ public Point2(float _x, float _y) /* */ { /* 33 */ set(_x, _y); /* */ } /* */ /* */ public Point2(Point2 p) /* */ { /* 38 */ this.x = p.x; /* 39 */ this.y = p.y; /* */ } /* */ /* */ /* */ /* */ public Point2 copy(Point2 b) /* */ { /* 46 */ this.x = b.x; /* 47 */ this.y = b.y; /* 48 */ return this; /* */ } /* */ /* */ public void set(float _x, float _y) { /* 52 */ this.x = _x; /* 53 */ this.y = _y; /* */ } /* */ /* */ /* */ /* */ /* */ public float length() /* */ { /* 61 */ return (float)Math.sqrt(this.x * this.x + this.y * this.y); /* */ } /* */ /* */ /* */ /* */ /* */ public Point2 normalize() /* */ { /* 69 */ float len = length(); /* 70 */ if (len > 0.0F) { /* 71 */ dividedBy(len); /* */ } /* 73 */ return this; /* */ } /* */ /* */ /* */ /* */ /* */ public Point2 negate() /* */ { /* 81 */ this.x = (-this.x); /* 82 */ this.y = (-this.y); /* */ /* 84 */ return this; /* */ } /* */ /* */ /* */ public Point2 plus(Point2 p) /* */ { /* 90 */ this.x += p.x; /* 91 */ this.y += p.y; /* */ /* 93 */ return this; /* */ } /* */ /* */ /* */ public Point2 plus(float v) /* */ { /* 99 */ this.x += v; /* 100 */ this.y += v; /* */ /* 102 */ return this; /* */ } /* */ /* */ /* */ public Point2 minus(float v) /* */ { /* 108 */ return plus(-v); /* */ } /* */ /* */ /* */ public Point2 minus(Point2 p) /* */ { /* 114 */ this.x -= p.x; /* 115 */ this.y -= p.y; /* */ /* 117 */ return this; /* */ } /* */ /* */ /* */ public Point2 times(float v) /* */ { /* 123 */ this.x *= v; /* 124 */ this.y *= v; /* */ /* 126 */ return this; /* */ } /* */ /* */ /* */ public Point2 times(Point2 p) /* */ { /* 132 */ this.x *= p.x; /* 133 */ this.y *= p.y; /* */ /* 135 */ return this; /* */ } /* */ /* */ /* */ public Point2 dividedBy(float v) /* */ { /* 141 */ this.x /= v; /* 142 */ this.y /= v; /* */ /* 144 */ return this; /* */ } /* */ /* */ /* */ public Point2 dividedBy(Point2 p) /* */ { /* 150 */ this.x /= p.x; /* 151 */ this.y /= p.y; /* */ /* 153 */ return this; /* */ } /* */ /* */ /* */ public float dot(Point2 p) /* */ { /* 159 */ return p.x * this.x + p.y * this.y; /* */ } /* */ /* */ public String toString() /* */ { /* 164 */ return this.x + "," + this.y; /* */ } /* */ /* 167 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 171 */ s.saveVersion(0, classCookie); /* 172 */ s.saveFloat(this.x); /* 173 */ s.saveFloat(this.y); /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException /* */ { /* 178 */ switch (r.restoreVersion(classCookie)) { /* */ case 0: /* 180 */ this.x = r.restoreFloat(); /* 181 */ this.y = r.restoreFloat(); /* 182 */ break; /* */ default: /* 184 */ throw new TooNewException(); /* */ } /* */ } /* */ /* */ public void postRestore(int version) {} /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\Point2.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */