Package com.ardor3d.math

Examples of com.ardor3d.math.Vector2


            aRecord.visited = true;
        }
    }

    private static void applyAnchor(final UIComponent comp, final AnchorLayoutData layData) {
        final Vector2 offsetsA = AnchorLayout.getOffsets(comp, layData.getMyPoint(), null);
        final Vector2 offsetsB = AnchorLayout.getOffsets(layData.getParent(), layData.getParentPoint(), null);
        comp.addTranslation(offsetsB.getX() - offsetsA.getX() + layData.getXOffset(), offsetsB.getY() - offsetsA.getY()
                + layData.getYOffset(), 0);
        if (!comp.hasAncestor(layData.getParent())) {
            comp.addTranslation(layData.getParent().getTranslation());
        }
    }
View Full Code Here


        }
    }

    private static Vector2 getOffsets(final UIComponent comp, final Alignment point, Vector2 store) {
        if (store == null) {
            store = new Vector2();
        }

        final Rectangle2 rect = new Rectangle2();
        comp.getRelativeComponentBounds(rect);
        switch (point) {
View Full Code Here

    public RenderedTextData getData() {
        return data;
    }

    public Vector2 findCaretTranslation(final int caretPosition, final Vector2 store) {
        Vector2 rVal = store;
        if (rVal == null) {
            rVal = new Vector2(0, 0);
        }

        if (data._lineHeights == null) {
            return rVal;
        }

        int lineHeight = data._lineHeights.get(0);
        int cursorY = 0;
        for (int j = 1; j < data._lineEnds.size(); j++) {
            if (data._lineEnds.get(j) < caretPosition) {
                cursorY += lineHeight;
                lineHeight = data._lineHeights.get(j);
            } else {
                break;
            }
        }

        if (caretPosition < data._xStarts.size()) {
            rVal.setX(data._xStarts.get(caretPosition));
        } else {
            final CharacterDescriptor charDesc = data._characters.get(caretPosition - 1);
            rVal.setX(data._xStarts.get(caretPosition - 1)
                    + (int) Math.round(charDesc.getScale() * charDesc.getXAdvance()));
        }
        rVal.setY(cursorY);

        return rVal;
    }
View Full Code Here

            return;
        }

        if (_lastInputWidget == null) {
            final Camera camera = source.getCanvasRenderer().getCamera();
            final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY());
            findPick(oldMouse, camera);
            if (_results.getNumber() <= 0) {
                return;
            }
View Full Code Here

        else if (!current.getButtonsPressedSince(previous).contains(_dragButton) && !_dragging) {
            return;
        }

        final Camera camera = source.getCanvasRenderer().getCamera();
        final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY());
        // Make sure we are dragging over the handle
        if (!_dragging) {
            findPick(oldMouse, camera);
            final Vector3 lastPick = getLastPick();
            if (lastPick == null) {
View Full Code Here

        if (!_calcRay.intersectsPlane(pickPlane, _calcVec3A)) {
            return _calcVec3A.zero();
        }

        // find out where we are hitting the plane now
        getPickRay(new Vector2(current.getX(), current.getY()), camera);
        if (!_calcRay.intersectsPlane(pickPlane, _calcVec3B)) {
            return _calcVec3A.zero();
        }

        // Cast us to the line along our arrow
View Full Code Here

        else if (!current.getButtonsPressedSince(previous).contains(_dragButton) && !_dragging) {
            return;
        }

        final Camera camera = source.getCanvasRenderer().getCamera();
        final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY());
        // Make sure we are dragging over the arrow
        if (!_dragging) {
            findPick(oldMouse, camera);
            final Vector3 lastPick = getLastPick();
            if (lastPick == null) {
View Full Code Here

        getPickRay(oldMouse, camera);
        _calcRay.intersectsPlane(pickPlane, _calcVec3A);
        final double oldHeight = _calcVec3A.getY();

        // find out where we are hitting the plane now
        getPickRay(new Vector2(current.getX(), current.getY()), camera);
        _calcRay.intersectsPlane(pickPlane, _calcVec3A);
        final double newHeight = _calcVec3A.getY();

        // Use distance between points against arrow length to determine how big we need to grow our bounding radius
        final double delta = newHeight - oldHeight;
View Full Code Here

        else if (!current.getButtonsPressedSince(previous).contains(_dragButton) && !_dragging) {
            return;
        }

        final Camera camera = source.getCanvasRenderer().getCamera();
        final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY());
        // Make sure we are dragging over the handle
        if (!_dragging) {
            findPick(oldMouse, camera);
            final Vector3 lastPick = getLastPick();
            if (lastPick == null) {
View Full Code Here

        if (!_calcRay.intersectsPlane(pickPlane, _calcVec3A)) {
            return _calcVec3A.zero();
        }

        // find out where we are hitting the plane now
        getPickRay(new Vector2(current.getX(), current.getY()), camera);
        if (!_calcRay.intersectsPlane(pickPlane, _calcVec3B)) {
            return _calcVec3A.zero();
        }

        // convert to target coord space
View Full Code Here

TOP

Related Classes of com.ardor3d.math.Vector2

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.