Package javax.vecmath

Examples of javax.vecmath.Vector2f


    public float getAngleAtNode(Node2D node){
        if(!getNodesAsList().contains(node))
            throw new IllegalArgumentException("Node is not contained in this "
                                               + "element: " + node.toString());
       
        Vector2f vnode = new Vector2f(node.getPoint2f());
        Vector2f[] vec = new Vector2f[2];
        int idx = 0;
        for(int i=0; i<3; i++){
            if(nodes[i] == node)
                continue;
           
            vec[idx] = new Vector2f(nodes[i].getPoint2f());
            vec[idx].sub(vnode);
            idx++;
        }
       
        return vec[0].angle(vec[1]);
View Full Code Here


      float y = Float.parseFloat(baseElement.getAttributeValue("y"));
      String playerName = baseElement.getAttributeValue("player");
      int might = Integer.parseInt(baseElement.getAttributeValue("might"));
      int nbAgents = Integer.parseInt(baseElement.getAttributeValue("nbAgents"));
     
      Vector2f position = new Vector2f(x, y);
      Player player = game.getPlayerManager().getPlayer(playerName);
     
     
      //Base base = new Base(id, might, player, position, nbAgents);
      Base base = new Base(might, player, position, nbAgents);
View Full Code Here

          listTemp.add(a, null);
        }
      }
    } while(!(listTemp.containsAll(game.getPlayerManager().getPlayers())));
   
    Base base0 = new Base(0, 2, listTemp.get(0), new Vector2f(50, 100), 10);
    Base base1 = new Base(1, 3, listTemp.get(1), new Vector2f(500, 450), 5);
    Base base2 = new Base(2, 2, listTemp.get(2), new Vector2f(30, 380), 10);
    Base base3 = new Base(3, 3, listTemp.get(3), new Vector2f(80, 280), 5);
    Base base4 = new Base(4, 2, listTemp.get(4), new Vector2f(430, 180), 10);
    Base base5 = new Base(5, 3, listTemp.get(5), new Vector2f(750, 185), 5);
    Base base6 = new Base(6, 2, listTemp.get(6), new Vector2f(600, 285), 10);
    Base base7 = new Base(7, 3, listTemp.get(7), new Vector2f(350, 385), 5);
    Base base8 = new Base(8, 2, listTemp.get(8), new Vector2f(550, 385), 10);
   
    game.getBaseManager().addBase(base0);
    game.getBaseManager().addBase(base1);
    game.getBaseManager().addBase(base2);
    game.getBaseManager().addBase(base3);
View Full Code Here

     
      // parametric equation
      float X = (float) (this.getPosition().getX() + increment*(to.getX() - this.getPosition().getX()));
      float Y = (float) (this.getPosition().getY() + increment*(to.getY() - this.getPosition().getY()));
     
      Vector2f newPosition = new Vector2f(X, Y);
     
      this.setPosition(newPosition);
      return true;
    }
    return false;
View Full Code Here

    this.setVisible(true);
    this.setBounds(0, 0, 150, 150);
  }
 
  public Agent() throws IOException {
    this(false, 0, 0, 0, 0, new Vector2f(0,0), null);
  }
View Full Code Here

  private Base baseOrigin;
  private Base baseDestination;
  private Vector2f vectorDirector;

  public GroupAgent(int nbInitialAgent, Base source, Base destination, Player player) throws IOException{
    super(true, 10, 10, 15, 15, new Vector2f(source.getPositionCenter().x, source.getPositionCenter().y), player);
    this.nbAgent = nbInitialAgent;
    this.baseOrigin = source;
    this.baseDestination = destination;
    this.position = new Vector2f(source.getPositionCenter().x, source.getPositionCenter().y);
    this.speed = 1;
    this.player = player;
    this.computeVectorDirector();

    this.setBackground(source.getPlayer().getColor());
View Full Code Here

  /**
   * Compute the Vector director, i.e the good direction agent to go
   */
  private void computeVectorDirector() {
    this.vectorDirector = new Vector2f();
    this.vectorDirector.x = this.baseDestination.getPositionCenter().x - baseOrigin.getPositionCenter().x;
    this.vectorDirector.y = baseDestination.getPositionCenter().y - baseOrigin.getPositionCenter().y;
    this.vectorDirector.normalize();
  }
View Full Code Here

  /**
   * @return the position of the center of the Base
   */
  public Vector2f getPositionCenter() {
    int size = AppliWindow.getInstance().getTilesSize();
    return new Vector2f(position.x + size/2, position.y + size/2);
  }
View Full Code Here

  public Base(int might){
    this(might, null);
  }
 
  public Base(int might, Player player){
    this(might, player, new Vector2f(0, 0));
  }
View Full Code Here

 
  public BuyTower(Player player, String typeTower, int x, int y) {
    super();
    this.player = player;
    this.typeTower = typeTower;
    this.position = new Vector2f(x, y);
  }
View Full Code Here

TOP

Related Classes of javax.vecmath.Vector2f

Copyright © 2018 www.massapicom. 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.