Advertisement
dgulczynski

enum

Jan 22nd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.81 KB | None | 0 0
  1. public enum Cialo {
  2.         Sun     (new Point(500, 500), 696342,         new Color(255,200,0)),
  3.         Mercury (Sun, 57909036.f,           2439,   0.241,  new Color(225,190,150)),
  4.         Venus   (Sun, 108208925.f,          6051,   0.615,  new Color(178,118,50)),
  5.         Earth   (Sun, 149597871.f,          6371,   1,      new Color(60, 180,200)),
  6.         Moon    (Earth, 384400.f,           1736,   0.0748, new Color(200,200,200)),
  7.         Mars    (Sun, 227936637.f,          3389,   1.881,  new Color(182,144,109)),
  8.         Jupiter (Sun, 778412028.f,          70000,  11.862, new Color(226,203,159)),
  9.         Saturn  (Sun, 1473838225.f,         60000,  29.457, new Color(248,243,172)),
  10.         Uran    (Sun, 2872428721.f,         25362,  84.011, new Color(151,188,208)),
  11.         Neptun  (Sun, 4494967229.f,         24662,  164.69, new Color(97, 138,211)),
  12.         Ceres   (Sun, 414082773.f,          945,    4.6054, new Color(158,151,156)),
  13.         Pluto   (Sun, 5906423142.f,         2370,   247.6,  new Color(165,126,103)),
  14.         Haumea  (Sun, 6483571729.f,         1379,   285.3,  new Color(203,203,203)),
  15.         Eris    (Sun, 10120295973.f,        2326,   556.4,  new Color(214,212,225)),
  16.         Makemake(Sun, 6845598576.f,         1500,   309.57, new Color(100,50, 40)),
  17.         Ganymede(Jupiter, 1882700.f,         2410,   0.0457, Color.LIGHT_GRAY),
  18.         Callisto(Jupiter, 1882700.f,         2410,   0.0457, Color.LIGHT_GRAY);
  19.  
  20.         Point position;
  21.         boolean stationary;
  22.         Cialo center;
  23.         double orbit;
  24.         double radius;
  25.         double period;
  26.         Color color;
  27.  
  28.         Cialo(Cialo center, double orbit, double radius, double period, Color color) {
  29.             this.center = center;
  30.             this.position = new Point();//center.getX()+orbit, center.getY());
  31.             stationary = false;
  32.             this.color = color;
  33.             this.radius = Math.sqrt(radius) / 10;
  34.             this.orbit = (Math.log10(orbit)-5.5)*100+this.radius;
  35.             //this.orbit = (Math.sqrt(orbit)/50+(Math.log10(orbit)-5.5)*50)*0.33+this.radius;
  36.             this.period = period * 365.256363004;
  37.         }
  38.  
  39.         Cialo(Point position, double radius, Color color) {
  40.             this.position = position;
  41.             this.stationary = true;
  42.             this.color = color;
  43.             this.radius = Math.sqrt(radius) / 10;
  44.         }
  45.  
  46.         void calcPosition(double angle) {
  47.             if (stationary) return;
  48.                 angle = angle / period;
  49.                 position.setLocation(center.getX() + orbit * Math.sin(angle),
  50.                         center.getY() + orbit * Math.cos(angle));
  51.         }
  52.  
  53.         public int getX() {
  54.             return (int) position.getX();
  55.         }
  56.  
  57.         public int getY() {
  58.             return (int) position.getY();
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement