Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1.     private Particle setShip() {
  2.         double diffX = earth.x - sun.x;
  3.         double diffY = earth.y - sun.y;
  4.  
  5.         double angle = Math.atan2(diffY, diffX) + Math.toRadians(ship_launchAngle);
  6.  
  7.         double shipRad = 50;
  8.  
  9.         double x = earth.x + ((earth.radius + shipRad + ship_height) * Math.cos(angle));
  10.         double y = earth.y + ((earth.radius + shipRad + ship_height) * Math.sin(angle));
  11.  
  12.         double vel = (ship_vo);
  13.         double Vx = earth.velX + vel * Math.cos((Math.PI / 2) + angle);
  14.         double Vy = earth.velY + vel * Math.sin((Math.PI / 2) + angle);
  15.  
  16.         return new Particle(x, y, Vx, Vy, ship_radius, ship_mass);
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement