Package eas.math.geometry

Examples of eas.math.geometry.Vector2D


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

        lov.rotate(Vector2D.NULL_VECTOR, 2 * Math.PI / 3);
       
        CollisionData collData;
       
        if (isLight) {
            collData = env.nearestRayCollisionIgnoreNonColliding(
View Full Code Here


    public ObstacleScene(final ParCollection params) {
        super("Rectangle obstacle scene", params);

        this.addCollidingAgent(
                new ObstacleAgent(0, null, null),
                new Vector2D(250, -5),
                0,
                new Vector2D(1, 1));
        this.addCollidingAgent(
                new ObstacleAgent(1, null, null),
                new Vector2D(250, 515),
                0,
                new Vector2D(1, 1));
        this.addCollidingAgent(
                new ObstacleAgent(2, null, null),
                new Vector2D(5, 255),
                90,
                new Vector2D(1, 1));
        this.addCollidingAgent(
                new ObstacleAgent(3, null, null),
                new Vector2D(495, 255),
                90,
                new Vector2D(1, 1));
    }
View Full Code Here

            final double precision = 17;
            final double radius = 7;
            pol = new Polygon2D();

            for (double d = 0; d < Math.PI * 2; d += Math.PI * 2 / precision) {
                pol.add(new Vector2D(Math.sin(d) * radius, Math.cos(d) * radius));
            }
        }

        return pol;
    }
View Full Code Here

    public ObstacleScene2(final ParCollection params) {
        super("Rectangle obstacle scene", params);

        this.addCollidingAgent(
                new ObstacleAgent(0, null, null),
                new Vector2D(250, -5),
                0,
                new Vector2D(1, 1));
        this.addCollidingAgent(
                new ObstacleAgent(1, null, null),
                new Vector2D(250, 515),
                0,
                new Vector2D(1, 1));
        this.addCollidingAgent(
                new ObstacleAgent(2, null, null),
                new Vector2D(5, 255),
                90,
                new Vector2D(1, 1));
        this.addCollidingAgent(
                new ObstacleAgent(3, null, null),
                new Vector2D(495, 255),
                90,
                new Vector2D(1, 1));
    }
View Full Code Here

 
    @Override
    public Polygon2D getAgentShape() {
        if (shape == null) {
            shape = Arrows.getPolygon();
            shape.scale(Vector2D.NULL_VECTOR, new Vector2D(0.2, 0.2));
//            shape.translateRootPointToMiddle();
        }
        return shape;
    }
View Full Code Here

   
    @Override
    public strictfp Polygon2D getAgentShape() {
        if (shape == null) {
            shape = new Polygon2D();
            shape.add(new Vector2D(0, 0));
            shape.add(new Vector2D(40, 0));
            shape.add(new Vector2D(40, 2));
            shape.add(new Vector2D(0, 2));
        }
       
        return shape;
    }
View Full Code Here

   
    @Override
    public strictfp Polygon2D getAgentShape() {
        if (shape == null) {
            shape = new Polygon2D();
            shape.add(new Vector2D(0, 0));
            shape.add(new Vector2D(100, 0));
            shape.add(new Vector2D(100, 2));
            shape.add(new Vector2D(0, 2));
        }
       
        return shape;
    }
View Full Code Here

  }
 
    @Override
    public Polygon2D getAgentShape() {
        Polygon2D p = new Polygon2D();
        p.add(new Vector2D(60, -10));
        p.add(new Vector2D(60, 10));
        p.add(new Vector2D(-60, 10));
        p.add(new Vector2D(-60, -10));
        return p;
    }
View Full Code Here

        Rectangle2D boundingBox = this.getBoundingBox();
        double currentWidth = boundingBox.getWidth();
        double currentHeight = boundingBox.getHeight();
        double desiredWidth = Math.abs(lowerRight.x - upperLeft.x);
        double desiredHeight = Math.abs(lowerRight.y - upperLeft.y);
        Vector2D newUpperLeftCorner = new Vector2D(Math.min(upperLeft.x, lowerRight.x), Math.min(upperLeft.y, lowerRight.y));
        Vector2D newLowerRightCorner = new Vector2D(Math.max(upperLeft.x, lowerRight.x), Math.max(upperLeft.y, lowerRight.y));
       
        double scaleX = desiredWidth / currentWidth;
        double scaleY = desiredHeight / currentHeight;
        double scale = Math.min(scaleX, scaleY);
       
        scaledScene.scaleScene(scale);
       
        double transX, transY;
       
        if (mode == Scene2D.FITTING_MODE_FIT_UPPER_LEFT) {
            Vector2D currentUpperLeftCorner = scaledScene.getBoundingBox().upperLeftCorner();
            transX = newUpperLeftCorner.x - currentUpperLeftCorner.x;
            transY = newUpperLeftCorner.y - currentUpperLeftCorner.y;
        } else if (mode == Scene2D.FITTING_MODE_FIT_LOWER_RIGHT) {
            Vector2D currentLowerRightCorner = scaledScene.getBoundingBox().lowerRightCorner();
            transX = newLowerRightCorner.x - currentLowerRightCorner.x;
            transY = newLowerRightCorner.y - currentLowerRightCorner.y;
        } else { // First case again - center mode not yet implemented!
            Vector2D currentUpperLeftCorner = scaledScene.getBoundingBox().upperLeftCorner();
            transX = newUpperLeftCorner.x - currentUpperLeftCorner.x;
            transY = newUpperLeftCorner.y - currentUpperLeftCorner.y;
        }
       
        Vector2D translation = new Vector2D(transX, transY);
       
        sceneCopy.translateScene(translation);
        sceneCopy.scaleScene(scale);
       
        this.clearScene();
View Full Code Here

     *      [ 1 ]   [   0    0    1   ] [ 1 ]   [         1         ]
     */
    public Vector2D getAgentPosition(final int agentID) {
        double[] matrix = new double[6];
        this.sceneTransformation.getMatrix(matrix);
        Vector2D pos = new Vector2D(this.agentPositions.get(agentID));
        double m00 = matrix[0];
        double m10 = matrix[1];
        double m01 = matrix[2];
        double m11 = matrix[3];
        double m02 = matrix[4];
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.