Package net.sf.fysix.math

Examples of net.sf.fysix.math.Vector2d.scale()


  public Vector2d getGravity(Vector2d pos) {
    Vector2d dist = new Vector2d(centerPoint.getX(), centerPoint.getY());
    dist.sub(pos);
    if (dist.length() > 0 && dist.length() < 250) {
      dist.scale(100.0/dist.length());
      return dist;
    } else {
      return new Vector2d(0, 0);
    }   
  }
View Full Code Here


     
      Vector2d p = wo.getPosition();
      for (Environment env : world.getEnvironments()) {
        Vector2d g = env.getGravity(p);
        double fr = env.getFriction(p);    // TODO Should we get rid of this?
        g.scale(wo.getBody().getMass());
        Vec2 point = wo.getBody().getWorldCenter();
        wo.getBody().applyForce(new Vec2((float) g.getX(), (float) g.getY()), point);
      }
     
      // Time space
View Full Code Here

 
  public Collection<Force> getForces() {
    List<Force> list = new ArrayList<Force>();
   
    Vector2d force = new Vector2d(0.0, -20000.0);
    force.scale(getForeStarboardEngineThrottle());
    list.add(new Force(new Vector2d(13.0, 0.0), force));
   
    force = new Vector2d(0.0, 20000.0);
    force.scale(getForePortEngineThrottle());
    list.add(new Force(new Vector2d(13.0, 0.0), force));
View Full Code Here

    Vector2d force = new Vector2d(0.0, -20000.0);
    force.scale(getForeStarboardEngineThrottle());
    list.add(new Force(new Vector2d(13.0, 0.0), force));
   
    force = new Vector2d(0.0, 20000.0);
    force.scale(getForePortEngineThrottle());
    list.add(new Force(new Vector2d(13.0, 0.0), force));
   
    force = new Vector2d(-14000.0, -14000.0);
    force.scale(getAftStarboardEngineThrottle());
    list.add(new Force(new Vector2d(-7.0, 5.0), force));
View Full Code Here

    force = new Vector2d(0.0, 20000.0);
    force.scale(getForePortEngineThrottle());
    list.add(new Force(new Vector2d(13.0, 0.0), force));
   
    force = new Vector2d(-14000.0, -14000.0);
    force.scale(getAftStarboardEngineThrottle());
    list.add(new Force(new Vector2d(-7.0, 5.0), force));
   
    force = new Vector2d(-14000.0, 14000.0);
    force.scale(getAftPortEngineThrottle());
    list.add(new Force(new Vector2d(-7.0, -5.0), force));
View Full Code Here

    force = new Vector2d(-14000.0, -14000.0);
    force.scale(getAftStarboardEngineThrottle());
    list.add(new Force(new Vector2d(-7.0, 5.0), force));
   
    force = new Vector2d(-14000.0, 14000.0);
    force.scale(getAftPortEngineThrottle());
    list.add(new Force(new Vector2d(-7.0, -5.0), force));
   
    return list;
  }
View Full Code Here

 
  public Collection<Force> getForces() {
    List<Force> list = new ArrayList<Force>();
   
    Vector2d force = new Vector2d(200000.0, 0.0);
    force.scale(getMainEngineThrottle());
    list.add(new Force(new Vector2d(-7, 0.0), force));
 
    return list;
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.