Esempio n. 1
0
 public static void move(Position position, Motion motion)
 {
     // Calcluate the new position given the motion.
     // Update the position.
     double rad = motion.getDirection() * Math.PI / 180.0;
     double dx = motion.getVelocity() * Math.Cos(rad);
     double dy = motion.getVelocity() * Math.Sin(rad) * -1.0;
     position.setX(position.getX() + dx);
     position.setY(position.getY() + dy);
 }
Esempio n. 2
0
 public Body(double mass, double x, double y, double velocity, double direciton)
 {
     this.mass = mass;
     this.position = new Position(x,y);
     this.motion = new Motion(velocity,direciton);
 }
 public Body(double mass, double x, double y, double velocity, double direciton)
 {
     this.mass     = mass;
     this.position = new Position(x, y);
     this.motion   = new Motion(velocity, direciton);
 }
Esempio n. 4
0
 public Beam(double x, double y, double velocity, double direciton)
 {
     this.position = new Position(x,y);
     this.motion = new Motion(velocity,direciton);
 }
 public Beam(double x, double y, double velocity, double direciton)
 {
     this.position = new Position(x, y);
     this.motion   = new Motion(velocity, direciton);
 }