Package eas.math.geometry

Examples of eas.math.geometry.Vector2D.translate()


            newShape.add(new Vector2D(v));
        }
        newShape.rotate(Vector2D.NULL_VECTOR, this.getAgentAngle(agentID));
        for (Vector2D p : newShape) {
            Vector2D reqPos = new Vector2D(newPosition);
            reqPos.translate(p);
            if (this.getPix((int) Math.round(reqPos.x), (int) Math.round(reqPos.y))) {
                // Redraw old position.
                this.drawTile(
                        this.getAgent(agentID).getAgentShape(),
                        this.getAgentPosition(agentID),
View Full Code Here


        Vector2D aktPos = this.getAgentPosition(0);
        Vector2D newpos = new Vector2D(aktPos);
        Polygon2D pol = this.getAgentShape(0);
        double angle = this.getAgentAngle(0);
       
        newpos.translate(new Vector2D(0, 1));
        if (!this.setAgentPosition(0, newpos)) {
            this.removeAgent(0);
            this.drawTile(
                    pol,
                    aktPos,
View Full Code Here

    }
   
    public synchronized void senkeAb() {
        Vector2D aktPos = this.getAgentPosition(0);
        Vector2D newpos = new Vector2D(aktPos);
        newpos.translate(new Vector2D(0, 1));
        while (this.setAgentPosition(0, newpos)) {
            aktPos = this.getAgentPosition(0);
            newpos = new Vector2D(aktPos);
            newpos.translate(new Vector2D(0, 1));
        }
View Full Code Here

        Vector2D newpos = new Vector2D(aktPos);
        newpos.translate(new Vector2D(0, 1));
        while (this.setAgentPosition(0, newpos)) {
            aktPos = this.getAgentPosition(0);
            newpos = new Vector2D(aktPos);
            newpos.translate(new Vector2D(0, 1));
        }
        this.step(null);
    }
   
    /**
 
View Full Code Here

                        angle = Math.PI * 2;
                    }
                    env.setAgentAngle(0, angle);
                }
                if (pressed.equals("4") || pressed.equals(ConstantsSimulation.ARROW_KEY_ENCODING_LEFT)) {
                    newpos.translate(new Vector2D(-1, 0));
                    env.setAgentPosition(agent.id(), newpos);
                }
                if (pressed.equals("6") || pressed.equals(ConstantsSimulation.ARROW_KEY_ENCODING_RIGHT)) {
                    newpos.translate(new Vector2D(1, 0));
                    env.setAgentPosition(agent.id(), newpos);
View Full Code Here

                if (pressed.equals("4") || pressed.equals(ConstantsSimulation.ARROW_KEY_ENCODING_LEFT)) {
                    newpos.translate(new Vector2D(-1, 0));
                    env.setAgentPosition(agent.id(), newpos);
                }
                if (pressed.equals("6") || pressed.equals(ConstantsSimulation.ARROW_KEY_ENCODING_RIGHT)) {
                    newpos.translate(new Vector2D(1, 0));
                    env.setAgentPosition(agent.id(), newpos);
                }
                if (pressed.equals("5") || pressed.equals(ConstantsSimulation.ARROW_KEY_ENCODING_DOWN)) {
                    newpos.translate(new Vector2D(0, 1));
                    env.setAgentPosition(agent.id(), newpos);
View Full Code Here

                if (pressed.equals("6") || pressed.equals(ConstantsSimulation.ARROW_KEY_ENCODING_RIGHT)) {
                    newpos.translate(new Vector2D(1, 0));
                    env.setAgentPosition(agent.id(), newpos);
                }
                if (pressed.equals("5") || pressed.equals(ConstantsSimulation.ARROW_KEY_ENCODING_DOWN)) {
                    newpos.translate(new Vector2D(0, 1));
                    env.setAgentPosition(agent.id(), newpos);
                }
                if (pressed.equals(" ")) {
                    env.senkeAb();
                }
View Full Code Here

        return this.setAgentAngle(0, angle);
    }
   
    public boolean sink() {
        Vector2D newpos = new Vector2D(this.getAgentPosition(0));
        newpos.translate(new Vector2D(0, 1));
        boolean worked = this.setAgentPosition(0, newpos);
       
        if (worked) {
            deepness++;
        }
View Full Code Here

        return worked;
    }
   
    public boolean shiftLeft() {
        Vector2D newpos = new Vector2D(this.getAgentPosition(0));
        newpos.translate(new Vector2D(-1, 0));
        return this.setAgentPosition(0, newpos);
    }
   
    public boolean shiftRight() {
        Vector2D newpos = new Vector2D(this.getAgentPosition(0));
View Full Code Here

        return this.setAgentPosition(0, newpos);
    }
   
    public boolean shiftRight() {
        Vector2D newpos = new Vector2D(this.getAgentPosition(0));
        newpos.translate(new Vector2D(1, 0));
        return this.setAgentPosition(0, newpos);
    }
   
    public boolean applyMove(TetrisMove move) {
        if (move.getMove() == TetrisMove.MOVE_LEFT) {return this.shiftLeft();}
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.