Package eas.math.geometry

Examples of eas.math.geometry.Rectangle2D


        }
        if (numBadAgents < 1) {
            numBadAgents = 1;
        }
       
        Rectangle2D bound = new Rectangle2D(env.getBoundingBox(false));
       
        double puffer = 100;
        bound.setLeft(bound.upperLeftCorner().x + puffer);
        bound.setRight(bound.lowerRightCorner().x - puffer);
        bound.setTop(bound.upperLeftCorner().y + puffer);
        bound.setBottom(bound.lowerRightCorner().y - puffer);
       
        for (int j = 0; j < numGoodAgents; j++) {
            agent = new JasmineRobotWithoutMutationRegularSelection(
                    j,
                    env,
                    rand,
                    params,
                    true,
                    360,
                    gutesGenom,
                    schlechtesGenom);
            brain = new MARBBrain<AbstractAgent2D<?>>(
                    agent,
                    gutesGenom,
                    params);
            agent.implantBrain(brain);

            pos = new Vector2D(
                    rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                    rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            richt = rand.nextDouble() * 360;
           
            while (!env.addCollidingAgent(
                    agent,
                    pos, richt)) {
                pos = new Vector2D(
                        rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                        rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            }
           
        }

        for (int j = 0; j < numBadAgents; j++) {
            agent = new JasmineRobotWithoutMutationRegularSelection(
                    j,
                    env,
                    rand,
                    params,
                    true,
                    360,
                    gutesGenom,
                    schlechtesGenom);
            brain = new MARBBrain<AbstractAgent2D<?>>(
                    agent,
                    schlechtesGenom,
                    params);
            agent.implantBrain(brain);

            pos = new Vector2D(
                    rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                    rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            richt = rand.nextDouble() * 360;
           
            while (!env.addCollidingAgent(
                    agent,
                    pos, richt)) {
                pos = new Vector2D(
                        rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                        rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            }
           
        }
       
        env.getJasmineAgents();
View Full Code Here


        }
        if (numBadAgents < 1) {
            numBadAgents = 1;
        }
       
        Rectangle2D bound = new Rectangle2D(env.getBoundingBox(false));
       
        double puffer = 100;
        bound.setLeft(bound.upperLeftCorner().x + puffer);
        bound.setRight(bound.lowerRightCorner().x - puffer);
        bound.setTop(bound.upperLeftCorner().y + puffer);
        bound.setBottom(bound.lowerRightCorner().y - puffer);
       
        for (int j = 0; j < numGoodAgents; j++) {
            agent = new JasmineRobotWithoutMutationMatrixSelection(
                    j,
                    env,
                    rand,
                    params,
                    true,
                    360,
                    gutesGenom,
                    schlechtesGenom,
                    wkeitsMatrix);
            brain = new MARBBrain<AbstractAgent2D<?>>(
                    agent,
                    gutesGenom,
                    params);
            agent.implantBrain(brain);

            pos = new Vector2D(
                    rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                    rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            richt = rand.nextDouble() * 360;
           
            while (!env.addCollidingAgent(
                    agent,
                    pos, richt)) {
                pos = new Vector2D(
                        rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                        rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            }
           
        }

        for (int j = 0; j < numBadAgents; j++) {
            agent = new JasmineRobotWithoutMutationMatrixSelection(
                    j,
                    env,
                    rand,
                    params,
                    true,
                    360,
                    gutesGenom,
                    schlechtesGenom,
                    wkeitsMatrix);
            brain = new MARBBrain<AbstractAgent2D<?>>(
                    agent,
                    schlechtesGenom,
                    params);
            agent.implantBrain(brain);

            pos = new Vector2D(
                    rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                    rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            richt = rand.nextDouble() * 360;
           
            while (!env.addCollidingAgent(
                    agent,
                    pos, richt)) {
                pos = new Vector2D(
                        rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                        rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            }
           
        }
       
        env.getJasmineAgents();
View Full Code Here

            g = img.createGraphics();
        } else {
            g = g2;
        }
       
        Rectangle2D clip = this.getClippingRectangle();
       
        g.clipRect(
                (int) clip.upperLeftCorner().x,
                (int) clip.upperLeftCorner().y,
                (int) clip.lowerRightCorner().x + 1,
                (int) clip.lowerRightCorner().y + 1);

        g.setColor(Color.black);
        if (!this.getParCollection().getParValueBoolean("showMinuteSegments")) {
            double large = 0.65 * this.globalScale();
            double huge = 1.25 * this.globalScale();
 
View Full Code Here

                Vector2D liob = new Vector2D(pos);
                Vector2D reun = new Vector2D(pos);
                liob.sub(quadratRadius, quadratRadius);
                reun.add(quadratRadius, quadratRadius);
               
                Rectangle2D box = new Rectangle2D(liob, reun);
                List<Integer> neighbors = env.calculateAgentsInBox(box);
                double anzahl = 0;
                double winkelSumme = 0;
               
                for (int i : neighbors) {
View Full Code Here

       
        int width = this.getGridWidth();
        int height = this.getGridHeight();
        float epsilon = (float) 0.5;
       
        Rectangle2D r = new Rectangle2D(new Vector2D(0 - epsilon, 0 - epsilon), new Vector2D(width - epsilon, height - epsilon));
        LineSegment2D l = new LineSegment2D(new Vector2D(0 - epsilon, heightGO + epsilon), new Vector2D(this.getWidth() - epsilon, heightGO + epsilon));
        g.setColor(Color.red);
        g.drawPolygon(this.getPolygonInVisualization(l.toPol2D()).toPol());
        g.setStroke(new BasicStroke(5));
        g.setColor(Color.orange);
        g.drawPolygon(this.getPolygonInVisualization(r.toPol2D()).toPol());
       
        g.setColor(Color.black);
        g.setStroke(new BasicStroke(8));
       
        float maxX = Float.NEGATIVE_INFINITY;
View Full Code Here

       
        if (numAgents < 1) {
            numAgents = 1;
        }
       
        Rectangle2D bound = new Rectangle2D(env.getBoundingBox(false));
       
        double puffer = 100;
        bound.setLeft(bound.upperLeftCorner().x + puffer);
        bound.setRight(bound.lowerRightCorner().x - puffer);
        bound.setTop(bound.upperLeftCorner().y + puffer);
        bound.setBottom(bound.lowerRightCorner().y - puffer);
       
        for (int j = 0; j < numAgents; j++) {
            if (j == 56 && params.getParValueInt("TilesVertically") > 0) {
                System.out.println();
            }
           
            agent = new JasmineRobot(j, env, rand, params, false, 0);
            brain = new MARBBrain<AbstractAgent2D<?>>(
                    agent,
//                  "001, 003, 003, 001, 000, 012, 004, 196, 000, 015, 000, 012, 007, 135, 000, 006, 000, 010, 000, 000, 001, 001, 000, 012, 001, 191, 000, 004, 000, 012, 001, 032, 000, 005, 000, 012, 003, 073, 000, 015, 000, 011, 000, 012, 004, 170, 000, 016, 000, 010, 000, 010, 000, 000, 005, 001, 000, 012, 004, 000, 012, 007, 000, 015, 000, 012, 001, 073, 000, 008, 000, 011, 000, 000, 011, 001, 000, 000, 000, 015, 003, 003, 001, 000, 000, 000, 011, 004, 001, 001, 000, 012, 006, 031, 000, 008, 000, 000, 022, 001, 000, 000, 000, 026, 003, 005, 001, 000, 000, 000, 010, 002, 005, 001, 000, 000, 000, 009, 003, 004, 001, 000, 012, 006, 108, 000, 009, 000, 012, 004, 140, 000, 016, 000, 010, 000, 012, 006, 125, 000, 008, 000, 011, 000, 000, 010, 001, 000, 012, 001, 092, 000, 016, 000, 012, 003, 113, 000, 016, 000, 012, 001, 017, 000, 015, 000, 012, 003, 000, 012, 001, 000, 008, 000, 011, 000, 010, 000, 010, 000, 000, 006, 001, 000, 012, 001, 163, 000, 009, 000, 012, 003, 000, 012, 001, 000, 015, 000, 010, 000, 000, 015, 001, 000, 012, 002, 013, 000, 016, 000, 012, 005, 091, 000, 006, 000, 010, 000, 000, 011, 001, 000, 000, 000, 022, 004, 005, 001, 000, 012, 003, 140, 000, 009, 000, 012, 007, 098, 000, 009, 000, 010, 000, 012, 001, 071, 000, 008, 000, 012, 007, 210, 000, 008, 000, 011, 000, 010, 000, 000, 015, 001, 000, 000, 000, 006, 005, 003, 001, 000, 012, 006, 045, 000, 015, 000, 000, 011, 001, 000, 000, 000, 005, 005, 009, 001, 000, 012, 006, 158, 000, 015, 000, 012, 006, 132, 000, 009, 000, 012, 004, 080, 000, 009, 000, 012, 002, 000, 012, 005, 000, 016, 000, 010, 000, 011, 000, 011, 000, 000, 006, 001, 000, 012, 003, 247, 000, 008, 000, 012, 004, 089, 000, 008, 000, 011, 000, 000, 009, 001, 000, 012, 005, 253, 000, 016, 000, 000, 004, 001, 000, 012, 005, 095, 000, 009, 000, 012, 006, 045, 000, 009, 000, 010, 000, 000, 019, 001, 000, 012, 005, 081, 000, 015, 000, 012, 005, 213, 000, 009, 000, 010, 000, 000, 026, 001, 000, 012, 007, 000, 012, 005, 000, 015, 000, 000, 011, 001, 000, 000, 000, 004, 005, 003, 001, 000, 000, 000, 019, 005, 001, 001, 000, 012, 007, 000, 012, 002, 000, 015, 000, 000, 002, 001, 000, 000, 000, 002, 005, 004, 001, 000, 012, 006, 143, 000, 008, 000, 012, 007, 199, 000, 015, 000, 011, 000, 000, 002, 001, 000, 000, 000",
                    "",
                    params);
            agent.implantBrain(brain);
           
            pos = new Vector2D(
                    rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                    rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            richt = rand.nextDouble() * 360;
           
            while (!env.addCollidingAgent(
                    agent,
                    pos, richt)) {
                pos = new Vector2D(
                        rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                        rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            }
           
        }
       
        return new MARBFastEnvironment[] { env };
View Full Code Here

       
        if (numAgents < 1) {
            numAgents = 1;
        }
       
        Rectangle2D bound = new Rectangle2D(env.getBoundingBox(false));
       
        double puffer = 100;
        bound.setLeft(bound.upperLeftCorner().x + puffer);
        bound.setRight(bound.lowerRightCorner().x - puffer);
        bound.setTop(bound.upperLeftCorner().y + puffer);
        bound.setBottom(bound.lowerRightCorner().y - puffer);
       
        for (int j = 0; j < numAgents; j++) {
            agent = new JasmineRobot(j, env, rand, params, true, 0);
            brain = new MARBBrain<AbstractAgent2D<?>>(
                    agent,
//                        "001, 003, 003, 001, 000, 012, 004, 196, 000, 015, 000, 012, 007, 135, 000, 006, 000, 010, 000, 000, 001, 001, 000, 012, 001, 191, 000, 004, 000, 012, 001, 032, 000, 005, 000, 012, 003, 073, 000, 015, 000, 011, 000, 012, 004, 170, 000, 016, 000, 010, 000, 010, 000, 000, 005, 001, 000, 012, 004, 000, 012, 007, 000, 015, 000, 012, 001, 073, 000, 008, 000, 011, 000, 000, 011, 001, 000, 000, 000, 015, 003, 003, 001, 000, 000, 000, 011, 004, 001, 001, 000, 012, 006, 031, 000, 008, 000, 000, 022, 001, 000, 000, 000, 026, 003, 005, 001, 000, 000, 000, 010, 002, 005, 001, 000, 000, 000, 009, 003, 004, 001, 000, 012, 006, 108, 000, 009, 000, 012, 004, 140, 000, 016, 000, 010, 000, 012, 006, 125, 000, 008, 000, 011, 000, 000, 010, 001, 000, 012, 001, 092, 000, 016, 000, 012, 003, 113, 000, 016, 000, 012, 001, 017, 000, 015, 000, 012, 003, 000, 012, 001, 000, 008, 000, 011, 000, 010, 000, 010, 000, 000, 006, 001, 000, 012, 001, 163, 000, 009, 000, 012, 003, 000, 012, 001, 000, 015, 000, 010, 000, 000, 015, 001, 000, 012, 002, 013, 000, 016, 000, 012, 005, 091, 000, 006, 000, 010, 000, 000, 011, 001, 000, 000, 000, 022, 004, 005, 001, 000, 012, 003, 140, 000, 009, 000, 012, 007, 098, 000, 009, 000, 010, 000, 012, 001, 071, 000, 008, 000, 012, 007, 210, 000, 008, 000, 011, 000, 010, 000, 000, 015, 001, 000, 000, 000, 006, 005, 003, 001, 000, 012, 006, 045, 000, 015, 000, 000, 011, 001, 000, 000, 000, 005, 005, 009, 001, 000, 012, 006, 158, 000, 015, 000, 012, 006, 132, 000, 009, 000, 012, 004, 080, 000, 009, 000, 012, 002, 000, 012, 005, 000, 016, 000, 010, 000, 011, 000, 011, 000, 000, 006, 001, 000, 012, 003, 247, 000, 008, 000, 012, 004, 089, 000, 008, 000, 011, 000, 000, 009, 001, 000, 012, 005, 253, 000, 016, 000, 000, 004, 001, 000, 012, 005, 095, 000, 009, 000, 012, 006, 045, 000, 009, 000, 010, 000, 000, 019, 001, 000, 012, 005, 081, 000, 015, 000, 012, 005, 213, 000, 009, 000, 010, 000, 000, 026, 001, 000, 012, 007, 000, 012, 005, 000, 015, 000, 000, 011, 001, 000, 000, 000, 004, 005, 003, 001, 000, 000, 000, 019, 005, 001, 001, 000, 012, 007, 000, 012, 002, 000, 015, 000, 000, 002, 001, 000, 000, 000, 002, 005, 004, 001, 000, 012, 006, 143, 000, 008, 000, 012, 007, 199, 000, 015, 000, 011, 000, 000, 002, 001, 000, 000, 000",
                    "001, 003, 001, 001, 000, 000, 000",
                    params);
            agent.implantBrain(brain);
           
            pos = new Vector2D(
                    rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                    rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            richt = rand.nextDouble() * 360;
           
            while (!env.addCollidingAgent(
                    agent,
                    pos, richt)) {
                pos = new Vector2D(
                        rand.nextDouble() * (bound.lowerRightCorner().x - bound.upperLeftCorner().x) + bound.upperLeftCorner().x,
                        rand.nextDouble() * (bound.lowerRightCorner().y - bound.upperLeftCorner().y) + bound.upperLeftCorner().y);
            }
           
        }
       
        return new GateEnvironment[] { env };
View Full Code Here

        if (pars.getParValueBoolean("ShowSelectionSquare")) {
            Graphics2D g = img.createGraphics();
            double width = pars
                    .getParValueDouble("SelektionsQuadratKantenlaenge");
            Rectangle2D rect;
            Polygon2D pol;

            g.setColor(Color.LIGHT_GRAY);
            for (AbstractAgent<?> a : this.getAgents()) {
                if (JasmineRobot.isJasmineRobot(a)) {
                    rect = new Rectangle2D(
                            new Vector2D(this.getAgentPosition(a.id()).x
                                    - width / 2,
                                    this.getAgentPosition(a.id()).y - width / 2),
                            new Vector2D(this.getAgentPosition(a.id()).x
                                    + width / 2,
                                    this.getAgentPosition(a.id()).y + width / 2));
                    pol = rect.toPol2D();
                    pol = this.getPolygonInVisualization(pol);
                    g.drawPolygon(pol.toPol());
                }
            }
        }
View Full Code Here

        }
    }
   
    public Polygon2D getPinkBorder() {
        double globalScale = this.globalScale();
        Rectangle2D visibleBox = this.getCurrentViewBox();

        Polygon2D b = visibleBox.toPol2D();
        b.scale(Vector2D.NULL_VECTOR, new Vector2D(globalScale, globalScale));
        Vector2D midTranslation = new Vector2D(screenWidth / 2, screenHeight / 2);
        midTranslation.sub(b.centerPoint());
        Polygon2D bound = visibleBox.toPol2D();
        bound.scale(Vector2D.NULL_VECTOR, new Vector2D(globalScale, globalScale));
        bound.translate(midTranslation);
        return bound;
    }
View Full Code Here

            final double screenWidthOneTime,
            final double screenHeightOneTime,
            final double screenAngleRADOneTime,
            final Vector2D screenAngleCenterPointOneTime,
            final Rectangle2D zoomBoxOneTime) {
        Rectangle2D oldZoom = null;
        Vector2D oldCenterPoint = this.getVisualizationAngleCenterPoint();
        double oldAngle = this.getVisualizationAngleRAD();
        if (this.zoomBox != null) {
            oldZoom = new Rectangle2D(this.zoomBox.upperLeftCorner(), this.zoomBox.lowerRightCorner());
        }
        double oldWidth = this.getScreenWidth();
        double oldHeight = this.getScreenHeight();
       
        this.setZoomBox(zoomBoxOneTime);
View Full Code Here

TOP

Related Classes of eas.math.geometry.Rectangle2D

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.