Package eas.math.geometry

Examples of eas.math.geometry.Vector2D


    protected void fitness(Wink simTime) {
        // Fitness Entfernung.
        if (this.fitnessEntfernung) {
            if (simTime.getLastTick() % 10 == 9) {
                Vector2D currentPos = this.getEnvironment().getAgentPosition(this.id());
                if (this.lastPos == null) {
                    this.lastPos = new Vector2D(currentPos);
                }
                fitness += this.lastPos.distance(currentPos);
                this.lastPos = currentPos;
            }
        }

        // Fitness GatePassing.
        if (this.fitnessGP) {
            Vector2D currentPos = new Vector2D(this.getEnvironment()
                    .getAgentPosition(this.id()));
            if (lastPosition != null) {
                double gatePosition = ((GateEnvironment) this
                        .getEnvironment()).getGatePositionX();
View Full Code Here


     *
     * @return  Das Turnier, falls eines existiert hat, <code>null</code> sonst.
     */
    protected void selection(@SuppressWarnings("unused") Wink simTime) {
        // Selektion.
        @SuppressWarnings("rawtypes")
        Vector2D liob = new Vector2D(((AbstractEnvironment2D) this.getEnvironment()).getAgentPosition(this.id()));
        Vector2D reun = new Vector2D(liob);
        liob.sub(new Vector2D(this.kantenLaenge, this.kantenLaenge));
        reun.translate(new Vector2D(this.kantenLaenge, this.kantenLaenge));
       
        Rectangle2D box = new Rectangle2D(liob, reun);
        @SuppressWarnings({ "rawtypes", "unchecked" })
        List<Integer> idList = ((AbstractEnvironment2D) this.getEnvironment()).calculateAgentsInBox(box);
        List<Evolvable<AbstractEvolvableAgent2D<AbstractEnvironment2D<?>>>> jasmineList = new ArrayList<Evolvable<AbstractEvolvableAgent2D<AbstractEnvironment2D<?>>>>(idList.size());
View Full Code Here

    }
   
    protected void pfuschFitnessEntfernung(Wink simTime) {
        // Fitness Entfernung.
        if (simTime.getLastTick() % 10 == 9) {
            @SuppressWarnings("rawtypes")
            Vector2D currentPos = ((AbstractEnvironment2D) this
                    .getEnvironment()).getAgentPosition(this.id());
            if (this.lastPos == null) {
                this.lastPos = new Vector2D(currentPos);
            }
            pfuschFitnessEntfernung += this.lastPos.distance(currentPos);
            this.lastPos = currentPos;
        }
       
View Full Code Here

        // Swap:
        int fitSwap;
       
        if (rob.getLetztKoord() == null) {
            rob.setLetztKoord(new Vector2D(rob.getPosition()));
        }
       
        if (this.haelfte(rob.getEnvironmentEA(), rob.getLetztKoord())
            != this.haelfte(rob.getEnvironmentEA(), rob.getPosition())) {
            if (rob.getPosition().x <= feld.length / 7
                || rob.getPosition().x >= feld.length * 6 / 7) {
                fitSwap = 50;
                rob.setLetztKoord(new Vector2D(rob.getPosition()));
            } else {
                fitSwap = 10;
            }
        } else {
            fitSwap = -1;
View Full Code Here

    private static Polygon2D jasmineShape;
   
    public static Polygon2D getJasmineShape() {
        if (jasmineShape == null) {
            jasmineShape = new Polygon2D();
            jasmineShape.add(new Vector2D(
                    0,
                    0));
            jasmineShape.add(new Vector2D(
                    ConstantsSimulation.ROB_AUSDEHNUNG_X,
                    0));
            jasmineShape.add(new Vector2D(
                    ConstantsSimulation.ROB_AUSDEHNUNG_X,
                    ConstantsSimulation.ROB_AUSDEHNUNG_Y));
            jasmineShape.add(new Vector2D(
                    0,
                    ConstantsSimulation.ROB_AUSDEHNUNG_Y));
            jasmineShape.translateRootPointToMiddle();
        }
       
View Full Code Here

                break;
            default:
                break;
            }
           
            Vector2D pos = new Vector2D((agent.getEnvironment()).getAgentPosition(agent.id()));
           
            pos.translate(new Vector2D(
                    xVersch * ConstantsSimulation.SCHRITTW,
                    yVersch * ConstantsSimulation.SCHRITTW));
           
            if ((agent.getEnvironment()).setAgentPosition(
                    agent.id(), pos)) {
View Full Code Here

        // Swap:
        int fitSwap;
       
        if (rob.getLetztKoord() == null) {
            rob.setLetztKoord(new Vector2D(rob.getPosition()));
        }
       
        if (this.haelfte(rob.getEnvironmentEA(), rob.getLetztKoord())
            != this.haelfte(rob.getEnvironmentEA(), rob.getPosition())) {
            fitSwap = 10;
            GlobaleMARBVariablen.setGateCount(GlobaleMARBVariablen.getGateCount() + 1);
        } else {
            fitSwap = 0;
        }

        rob.setLetztKoord(new Vector2D(rob.getPosition()));
       
        return fitSwap + fitCollAvoid - fitKoll;
    }
View Full Code Here

     * @return    Den temporären Fitnesswert für den aktuellen Zustand des
     *            Roboters.
     */
    @Override
    public int fitness(final RobEA rob) {
        Vector2D mitte = new Vector2D(
                rob.getEnvironmentEA().getDynWaende()[17].centerPoint());
        Vector2D robPosVer = new Vector2D(rob.getPosition());
        Vector2D robPos = new Vector2D(rob.getPosition());
        Vector2D robBlick = new Vector2D(rob.getBlickrichtung());
        robBlick.mult(30);
        robPosVer.translate(robBlick);

        Vector2D richtPos = new Vector2D(robPos);
        // Richtung von Mitte zu Position des Roboters.
        richtPos.sub(mitte);

        Vector2D richtPosVer = new Vector2D(robPosVer);
        // Richtung von Mitte zu verschobener Position des Roboters.
        richtPosVer.sub(mitte);
       
        if (richtPos.drehrichtung(richtPosVer)
                == ((GrZahnr) rob.getEnvironmentEA().getPluginObject(
                        new GrZahnr().id())).isUhrzgrSinn()) {
            GlobaleMARBVariablen.setRichtigeDrehRicht(
View Full Code Here

                    ignoreList.add(agt);
                }
            }
        }
       
        Vector2D lov = new Vector2D(env.getNormalizedLOV(agent.id()));

        lov.rotate(Vector2D.NULL_VECTOR, Math.PI / 3);

//        agent.v = new Vector2D(env.getAgentPosition(agent.id()));
//        lov.laengeFestlegen(100);
//        agent.v.add(lov);
        CollisionData collData;
View Full Code Here

  }

    @Override
    public Polygon2D getAgentShape() {
        if (wandaShape == null) {
            wandaShape = new Rectangle2D(new Vector2D(-0.5*cShapeSize,-0.5*cShapeSize),
                           new Vector2D(0.5*cShapeSize,0.5*cShapeSize)).toPol2D();
            if(this.getBrain() instanceof MDL2eBrain<?> && ((MDL2eBrain<?>) this.getBrain()).isActive())
                wandaShape.add(2, new Vector2D(0, 0.75*cShapeSize));
           
            /*wandaShape.add(Vector2D.NULL_VECTOR);
            for (int i = 0; i < irSensors.length; i++) {
              wandaShape.addAll(irSensors[i].getShape());
              wandaShape.add(Vector2D.NULL_VECTOR);
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.