Package eas.math.geometry

Examples of eas.math.geometry.Vector2D


            shape.add(new Vector2D(5, 2));
            shape.add(new Vector2D(-5, 2));
            shape.translateRootPointToMiddle(); */
           
            shape = new Polygon2D();
        shape.add(new Vector2D(-2.5, -2.5));
        shape.add(new Vector2D(2.5, -2.5));
        shape.add(new Vector2D(0, 5));
        }
       
        return shape;
    }
View Full Code Here


    @SuppressWarnings("unused")
    @Override
    public void step(Wink simTime) {
    super.step(simTime);
   
    Vector2D posMond = this.getEnvironment().getAgentPosition(0);
    Vector2D pos = this.getEnvironment().getAgentPosition(this.getID());

    /* Berechnung des Abstands zwischen Körper und Mond, Berechnung der Gravitationsbeschleunigung mit
     * g = Konstante * Masse des Körpers / Abstand^2 und anschließender Beschleunigung des Körpers */
  
    double xAbstand = posMond.x- pos.x;
View Full Code Here

  /* Form des Körpers */
  @Override
  public synchronized Polygon2D getAgentShape() {
    if (shape == null) {
      shape = new Polygon2D();
      shape.add(new Vector2D(-0.5, -0.5));
      shape.add(new Vector2D(-0.5, 0.5));
      shape.add(new Vector2D(0.5, 0.5));
      shape.add(new Vector2D(0.5, -0.5));
    }
    return shape;
  }
View Full Code Here

    super.step(simTime);
   
    this.color = Color.green;
   
    /* Position des Mondes und des JetAgenten */   
    Vector2D posMond = this.getEnvironment().getAgentPosition(100);
    Vector2D posRumpf = this.getEnvironment().getAgentPosition(0);
    ROVector2f pos = this.getPosition();
   
    /* Berechnung des Abstands zu Mond */
    double xAbstand = posMond.x - pos.getX();
    double yAbstand = posMond.y - pos.getY();
View Full Code Here

  /* Form des Körpers */
  @Override
  public synchronized Polygon2D getAgentShape() {
    if (shape == null) {
      shape = new Polygon2D();
      shape.add(new Vector2D(-0.5, -0.5));
      shape.add(new Vector2D(-0.5, 0.5));
      shape.add(new Vector2D(0.5, 0.5));
      shape.add(new Vector2D(0.5, -0.5));
    }
    return shape;
  }
View Full Code Here

   * @see eas.simulation.GenericActuator#actuate(eas.simulation.AbstractEnvironment, eas.simulation.AbstractAgent)
   */
  @Override
  public void actuate(DomPhysEnv env, PhysicsAgent2D<PhysicsEnvironment2D<?>> agent) {
    // TODO Auto-generated method stub
    Vector2D posMond = env.getAgentPosition(100);
    Vector2D pos = env.getAgentPosition(agent.id())
   
    /* Berechnung des Abstands zwischen Körper und Mond, Berechnung der Gravitationsbeschleunigung mit
     * g = Konstante * Masse des Körpers / Abstand^2 und anschließender Beschleunigung des Körpers
     */
    double Konstante = 10;
View Full Code Here

    // die Werte fuer Hassen abziehen
    for(int i = 0; i < 4; i++)
    {
      vektor[i] = vektor[i] - it.next();
    }
    Vector2D position = env.getAgentPosition(agent.id());
    makePositive(vektor);
    fahren(vektor, getDirection(vektor), false, env, agent, position );
  }
View Full Code Here

  {
    switch (direction) //hoffe, dass Kollisionen && rausfahren automatisch verhindert wird;
    {
    case 0://hoch
      if (env.getLight(position.x, position.y - 1) == null){
        boolean b = env.setAgentPosition(agent.id(), new Vector2D(position.x, position.y - 1));
        env.setAgentAngle(agent.id(), 180);
        if(b == false && !finish)
        {
          fahren(vektor, getDirectionOhne(vektor, direction), true, env, agent, position);
        }
      }
      break;
    case 1://runter
      if (env.getLight(position.x, position.y + 1) == null){
        boolean b = env.setAgentPosition(agent.id(), new Vector2D(position.x, position.y + 1));
        env.setAgentAngle(agent.id(), 0);
        if(b == false && !finish)
        {
          fahren(vektor, getDirectionOhne(vektor, direction), true, env, agent, position);
        }
      }
      break;
    case 2://links
      if (env.getLight(position.x - 1, position.y) == null){
        boolean b = env.setAgentPosition(agent.id(), new Vector2D(position.x - 1, position.y));
        env.setAgentAngle(agent.id(), 90);
        if(b == false && !finish)
        {
          fahren(vektor, getDirectionOhne(vektor, direction), true, env, agent, position);
        }
      }
      break;
    case 3://rechts
      if (env.getLight(position.x + 1, position.y ) == null){
       
        env.setAgentAngle(agent.id(), 270);
        boolean b = env.setAgentPosition(agent.id(), new Vector2D(position.x + 1, position.y));
        if(b == false && !finish)
        {
          fahren(vektor, getDirectionOhne(vektor, direction), true, env, agent, position);
        }
      }
View Full Code Here

        this.sensoren = new int[sens.length];
        for (int i = 0; i < sens.length; i++) {
            this.sensoren[i] = sens[i];
        }
       
        this.position = new Vector2D(pos.x, pos.y);
        this.winkel = wink;
        this.zustand = zust;
        this.breite = breit;
        this.laenge = lang;
    }
View Full Code Here

         * are reserved for SheepAgents (so, first possible id==10) uneven ids
         * beginning from 10 are reserved for WolfAgents (so, first possible
         * id==11)
         */
        env[0].addCollidingAgent((obstacleAgents[0] = new ObstacleAgent(0,
                env[0], params)), new Vector2D(250, -5), 0);
        env[0].addCollidingAgent((obstacleAgents[1] = new ObstacleAgent(1,
                env[0], params)), new Vector2D(250, 515), 0);
        env[0].addCollidingAgent((obstacleAgents[2] = new ObstacleAgent(2,
                env[0], params)), new Vector2D(5, 255), 90);
        env[0].addCollidingAgent((obstacleAgents[0] = new ObstacleAgent(3,
                env[0], params)), new Vector2D(495, 255), 90);

        sheepAgents = new SheepAgent[params.getParValueInt("numberOfSheep")];
        double sheepSpeed = (params.getParValueDouble("sheepSpeed"));
        for (int i = 0; i < sheepAgents.length; i++) {
            sheepAgents[i] = new SheepAgent(10 + 2 * i, env[0], sheepSpeed,
                    params.getParValueInt("numberOfDistanceSensors"), random,
                    0, params);
            /*
             * Area for deserialisation of existing NeuroBrains.
             */
            // if(i==0){
            // ObjectInputStream ois;
            // SparseNet neuralNet = null;
            // NeuroBrain neuroBrain=null;
            // try {
            // ois = new ObjectInputStream(new FileInputStream (new
            // File("agent#" + 10 + ".jos")));
            // neuralNet = (SparseNet)ois.readObject();
            // } catch (FileNotFoundException e) {
            // e.printStackTrace();
            // } catch (IOException e) {
            // e.printStackTrace();
            // } catch (ClassNotFoundException e) {
            // e.printStackTrace();
            // }
            // neuroBrain=new NeuroBrain(sheepAgents[i], random);
            // neuroBrain.net = neuralNet;
            // sheepAgents[i].implantBrain(neuroBrain);
            // }
            //
            //
            // else{
            // sheepAgents[i].implantBrain(new NeuroBrain(sheepAgents[i],
            // random));
            // }

            sheepAgents[i].getBrainControlledAgent().implantBrain(
                    new NeuroBrainChristian(sheepAgents[i], random));

            boolean sheepAgentCollides = true;
            Vector2D position = null;
            double angle = 0.0;
            do {
                try {
                    position = getRandomVector2D(random);
                    angle = random.nextDouble() * 360;
                    if (!env[0].collides(sheepAgents[i], position, angle, null)) {
                        sheepAgentCollides = false;
                    }
                } catch (Exception e) {
                    sheepAgentCollides = false;
                }
            } while (sheepAgentCollides);

            env[0].addCollidingAgent(sheepAgents[i], position, angle);
        }

        wolfAgents = new WolfAgent[params.getParValueInt("numberOfWolf")];
        double wolfSpeed = params.getParValueDouble("wolfSpeed");
        double detectionRadius = params
                .getParValueDouble("wolfDetectionRadius");
        double catchRadius = params.getParValueDouble("wolfCatchRadius");
        for (int i = 0; i < wolfAgents.length; i++) {
            wolfAgents[i] = new WolfAgent(10 + 2 * i + 1, env[0], wolfSpeed,
                    defaultNumberOfWolfDistanceSensors, detectionRadius,
                    catchRadius, random, params);

            boolean wolfAgentCollides = true;
            Vector2D position = null;
            double angle = 0.0;
            do {
                position = getRandomVector2D(random);
                angle = random.nextDouble() * 360;
                if (!env[0].collides(wolfAgents[i], position, angle, null)) {
View Full Code Here

TOP

Related Classes of eas.math.geometry.Vector2D

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.