Package com.barrybecker4.simulation.fluid.rendering

Examples of com.barrybecker4.simulation.fluid.rendering.RenderingOptions


            optimizer.doOptimization(strategy, initialGuess, SOLVED_THRESH);

        solution_ =
            new TantrixBoard(((TantrixPath)solution).getTilePlacements(), board.getPrimaryColor());

        TilePlacementList moves;
        if (evaluateFitness(solution) >= SOLVED_THRESH) {
            moves = ((TantrixPath)solution).getTilePlacements();
        } else {
            moves = null;
        }
View Full Code Here


        int numTiles = path.size();
        double distance = path.getEndPointDistance();
        boolean isLoop = distance == 0 && path.isLoop();

        ConsistencyChecker checker = new ConsistencyChecker(path.getTilePlacements(), path.getPrimaryPathColor());
        int numFits = checker.numFittingTiles();
        boolean allFit = numFits == numTiles;
        boolean consistentLoop = isLoop && allFit;
        boolean perfectLoop = false;
        double compactness = determineCompactness(path);
View Full Code Here

        boolean perfectLoop = false;
        double compactness = determineCompactness(path);

        if (consistentLoop) {
            Tantrix tantrix = new Tantrix(path.getTilePlacements());
            InnerSpaceDetector innerDetector = new InnerSpaceDetector(tantrix);
            perfectLoop = !innerDetector.hasInnerSpaces();
            //System.out.println("perfect loop");
        }

        double fitness =
                LOOP_PROXIMITY_WEIGHT * (numTiles - distance) / (0.1 + numTiles)
View Full Code Here

                               boolean useConcurrency) {
        super(board);
        puzzlePanel_ = puzzlePanel;
        strategy = useConcurrency ? OptimizationStrategyType.CONCURRENT_GENETIC_SEARCH :
                                    OptimizationStrategyType.GENETIC_SEARCH;
        evaluator = new PathEvaluator();
    }
View Full Code Here

     * @return list of moves to a solution.
     */
    @Override
    public TilePlacementList solve()  {

        ParameterArray initialGuess = new TantrixPath(board);
        assert(initialGuess.size() > 0) : "The random path should have some tiles!";
        long startTime = System.currentTimeMillis();

        Optimizer optimizer = new Optimizer(this);
        optimizer.setListener(this);

View Full Code Here

     * We show the current status.
     * @param params
     */
    public void optimizerChanged(ParameterArray params) {
        // update our current best guess at the solution.
        TantrixPath path = (TantrixPath)params;
        solution_ = new TantrixBoard(path.getTilePlacements(), path.getPrimaryPathColor());
        puzzlePanel_.refresh(solution_, numTries_++);
    }
View Full Code Here

    /**
     * Constructor.
     */
    public TantrixViewer() {
        renderer_ = new TantrixBoardRenderer();
    }
View Full Code Here

    }

    public FluidSimulator( FluidEnvironment environment ) {
        super("Fuild");
        environment_ = environment;
        renderOptions = new RenderingOptions();
        commonInit();
    }
View Full Code Here

        controlsPanel.add(legend_);
    }

    private JPanel createCheckBoxes() {

        RenderingOptions renderOpts =  simulator_.getRenderer().getOptions();

        // not yet supported.
        //useConcurrentCalculation_ = createCheckBox("Parallel calculation",
        //        "Will take advantage of multiple processors for calculation if present.", false);

        useConcurrentRendering_ = createCheckBox("Parallel rendering",
                "Will take advantage of multiple processors for rendering if present.", renderOpts.isParallelized());

        useLinearInterpolation_ = createCheckBox("Use linear interpolation",
                "If checked, use linear interpolation when rendering, to give a smoother look.",
                renderOpts.getUseLinearInterpolation());

        showVelocities_ = createCheckBox("Show velocities", "if checked, show velocity vectors",
                                          renderOpts.getShowVelocities());
        showGrid_ = createCheckBox("Show grid",
                "Draw the background grid that shows the cells.", renderOpts.getShowGrid());

        JPanel checkBoxes = new JPanel(new GridLayout(0, 2));

        //checkBoxes.add(useConcurrentCalculation_);
        checkBoxes.add(useConcurrentRendering_);
View Full Code Here

    }

    public void reset() {
        sliderGroup_.reset();
        // make sure we honor current check selections
        RenderingOptions renderOpts =  simulator_.getRenderer().getOptions();
        renderOpts.setShowGrid(showGrid_.isSelected());
        renderOpts.setShowVelocities(showVelocities_.isSelected());
        renderOpts.setUseLinearInterpolation(useLinearInterpolation_.isSelected());
    }
View Full Code Here

TOP

Related Classes of com.barrybecker4.simulation.fluid.rendering.RenderingOptions

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.