Examples of IntLocation


Examples of com.barrybecker4.common.geometry.IntLocation

        int colOffset = (Math.abs(row) % 2 == 1) ? -1 : 0;
        Location nbrLoc = null;

        switch (direction) {
            case 0 : nbrLoc = new IntLocation(row, col + 1); break;
            case 1 : nbrLoc = new IntLocation(row - 1, col + colOffset + 1); break;
            case 2 : nbrLoc = new IntLocation(row - 1, col + colOffset); break;
            case 3 : nbrLoc = new IntLocation(row, col - 1); break;
            case 4 : nbrLoc = new IntLocation(row + 1, col + colOffset); break;
            case 5 : nbrLoc = new IntLocation(row + 1, col + colOffset + 1); break;
            default : assert false;
        }
        return nbrLoc;
    }
View Full Code Here

Examples of com.barrybecker4.common.geometry.IntLocation

        Location currentPosition = maze.getStartPosition();
        MazeCell currentCell = maze.getCell(currentPosition);

        // push the initial moves
        stack.pushMoves( currentPosition, new IntLocation(0, 1), 1);
        panel_.paintAll();

        Location dir;
        int depth;
        boolean solved = false;
View Full Code Here

Examples of com.barrybecker4.common.geometry.IntLocation

        Location currentPosition = maze.getStartPosition();
        MazeCell currentCell = maze.getCell(currentPosition);
        currentCell.visited = true;

        // push the initial moves
        stack.pushMoves(currentPosition, new IntLocation(0, 1), 0);

        while ( !stack.isEmpty() && !interrupted ) {
            currentCell = findNextCell(currentCell);
        }
    }
View Full Code Here

Examples of com.barrybecker4.common.geometry.IntLocation

        grid_ = createGrid(width, height);

        // a border around the whole maze
        setConstraints();

        startPosition_ = new IntLocation( 2, 2 );
    }
View Full Code Here

Examples of com.barrybecker4.common.geometry.IntLocation

    private IntLocation firstCorner;
    private IntLocation secondCorner;
    private Box box;

    public void setFirstCorner(int x, int y) {
        firstCorner = new IntLocation(y, x);
    }
View Full Code Here

Examples of com.barrybecker4.common.geometry.IntLocation

    public void setFirstCorner(int x, int y) {
        firstCorner = new IntLocation(y, x);
    }

    public void setSecondCorner(int x, int y) {
        secondCorner = new IntLocation(y, x);
    }
View Full Code Here

Examples of com.barrybecker4.common.geometry.IntLocation

        if (firstCorner == null || secondCorner == null) return;
        box = findBox(aspectRatio, keepAspectRatio);

        g2.setColor(BOUNDING_BOX_COLOR);
        IntLocation topLeft = box.getTopLeftCorner();
        g2.drawRect(topLeft.getX(), topLeft.getY(), box.getWidth(), box.getHeight());
    }
View Full Code Here

Examples of com.barrybecker4.common.geometry.IntLocation

    }

    private Box findBox(double aspectRatio, boolean keepAspectRatio) {
        Box box = new Box(firstCorner, secondCorner);

        IntLocation topLeft = box.getTopLeftCorner();
        int width = box.getWidth();
        int height = box.getHeight();

        if (keepAspectRatio)  {
            if (width > height) {
                height = (int)(width / aspectRatio);
            } else {
                width = (int)(height * aspectRatio);
            }
            box = new Box(topLeft, new IntLocation(topLeft.getY() + height, topLeft.getX() + width));
        }
        return box;
    }
View Full Code Here

Examples of com.barrybecker4.common.geometry.IntLocation

         // verify that it is within the bounds of the grid
         assert (xPos <=  this.gridWidth_ && xPos > 0) : "invalid xpos = "+ xPos;
         assert (yPos <=  this.gridHeight_ && yPos > 0) : "invalid ypos = "+ yPos;

         return new IntLocation(yPos, xPos);
    }
View Full Code Here

Examples of com.barrybecker4.common.geometry.IntLocation

    OrientedPosition(OrientedPosition pos) {
        this(pos.x, pos.y, pos.angle);
    }

    IntLocation getLocation() {
        return new IntLocation((int)y, (int)x);
    }
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.