Package co.paralleluniverse.spacebase

Examples of co.paralleluniverse.spacebase.MutableAABB


            final FloatBuffer verticesb = (FloatBuffer) vertices.getBuffer();
            final FloatBuffer colorsb = (FloatBuffer) colors.getBuffer();
            long now = global.now();
            long clock = System.currentTimeMillis();
            fixPort(clock, true);
            MutableAABB currentPort = getCurrentPort(clock);
            portToMvMatrix(currentPort);
            double margins = WIDTH_MARGINS;

            final int n;
            if (clock - lastQueryTime > SB_QUERY_RATE) {
                n = query(now, SpatialQueries.contained(AABB.create(currentPort.min(X) - margins, currentPort.max(X) + margins, currentPort.min(Y) - margins, currentPort.max(Y) + margins)));
                lastQueryTime = clock;
            } else {
                n = indexGen.get();
                lastDispTime = clock;
            }
View Full Code Here


    }

    private MutableAABB getCurrentPort(final long ct) {
        if (portMaxXAnimation == 0 & portMaxYAnimation == 0)
            return port;
        MutableAABB currentPort = MutableAABB.create(2);
        final double width = port.max(X) - port.min(X);
        final double height = port.max(Y) - port.min(Y);
        final double ratio = height / width;
        double animation = Math.min(1.0, (double) (ct - portAnimationStartTime) / ANIMATION_DURATION);
        currentPort.min(X, port.min(X) + animation * portMinXAnimation);
        currentPort.min(Y, port.min(Y) + animation * portMinYAnimation);
        currentPort.max(X, port.max(X) + animation * portMaxXAnimation);
        currentPort.max(Y, port.max(Y) + animation * portMaxYAnimation);
        return currentPort;
    }
View Full Code Here

        }
        return aabb;
    }

    public AABB randomAABB(AABB bounds) {
        MutableAABB aabb = AABB.create(bounds.dims());
        for (int i = 0; i < bounds.dims(); i++) {
            double a = randRange(bounds.min(i), bounds.max(i));
            double b = randRange(bounds.min(i), bounds.max(i));
            aabb.min(i, (float) min(a, b));
            aabb.max(i, (float) max(a, b));
        }

        return floatify(aabb);
    }
View Full Code Here

        return floatify(aabb);
    }

    public AABB randomAABB(AABB bounds, double expSize, double variance) {
        MutableAABB aabb = AABB.create(bounds.dims());
        for (int i = 0; i < bounds.dims(); i++) {
            double tmp = getRandom().nextGaussian();
            double size = (tmp*tmp) * variance + expSize;
            if(expSize > 0 && size == 0)
                size = 0.01;
            double a = randRange(bounds.min(i), bounds.max(i) - size);
            aabb.min(i, (float) a);
            aabb.max(i, (float) (a + size));
        }

        return floatify(aabb);
    }
View Full Code Here

    private AABB getAABB() {
        return getAABB(state);
    }

    private static AABB getAABB(Record<SpaceshipState> state) {
        final MutableAABB aabb = AABB.create(2);
        getAABB(state, aabb);
        return aabb;
    }
View Full Code Here

TOP

Related Classes of co.paralleluniverse.spacebase.MutableAABB

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.