Exemple #1
0
 public Polar(Polar p) {
   init();
   length = p.length;
   angle = p.angle;
   origin = new Point(p.origin);
   rect = new Point(p.getRect());
 }
Exemple #2
0
 public Polar() {
   init();
   length = 0;
   angle = 0;
   origin = new Point(0, 0);
   setRect();
 }
Exemple #3
0
 public Polar(int x, int y, int r, int theta) {
   init();
   length = r;
   angle = theta;
   normalizeAngle();
   origin = new Point(x, y);
   setRect();
 }
Exemple #4
0
 public Polar(Point center, Point coord) {
   init();
   int dx = coord.x - center.x;
   int dy = coord.y - center.y;
   if (dx == 0 && dy == 0) {
     angle = 0;
     length = 0;
   } else {
     length = (int) Math.sqrt((dx * dx) + (dy * dy));
     angle = toDegrees(Math.atan2((double) dy, (double) dx));
   }
   origin = center;
   setRect();
 }