Package com.eagerlogic.cubee.client.utils

Examples of com.eagerlogic.cubee.client.utils.Point2D


        int bx = (int) (0 - ((bw - mw) * tcx));
        int by = (int) (0 - ((bh - mh) * tcy));
        double rot = rotate.get();
        if (rot != 0.0) {
            rot = rot * 360;
            Point2D tr = rotatePoint(bw, 0, rot);
            Point2D br = rotatePoint(bw, bh, rot);
            Point2D bl = rotatePoint(0, bh, rot);
            int minX = Math.min(Math.min(0, tr.getX()), Math.min(br.getX(), bl.getX()));
            int minY = Math.min(Math.min(0, tr.getY()), Math.min(br.getY(), bl.getY()));
            int maxX = Math.max(Math.max(0, tr.getX()), Math.max(br.getX(), bl.getX()));
            int maxY = Math.max(Math.max(0, tr.getY()), Math.max(br.getY(), bl.getY()));
            bw = maxX - minX;
            bh = maxY - minY;
            bx = minX;
            by = minY;
        }
View Full Code Here


        double cosAngle = Math.cos(angle);
        double sinAngle = Math.sin(angle);

        int resX = (int) ((x * cosAngle) - (y * sinAngle));
        int resY = (int) ((x * sinAngle) + (y * cosAngle));
        return new Point2D(resX, resY);
    }
View Full Code Here

        // rotatePoints
        if (rotate.get() != 1.0) {
            int rpx = (int) ((x2 - x1) * transformCenterX.get());
            int rpy = (int) ((y4 - y1) * transformCenterX.get());
            Point2D tl = rotatePoint(x1 - rpx, y1 - rpy, rotate.get());
            Point2D tr = rotatePoint(x2 - rpx, y2 - rpy, rotate.get());
            Point2D br = rotatePoint(x3 - rpx, y3 - rpy, rotate.get());
            Point2D bl = rotatePoint(x4 - rpx, y4 - rpy, rotate.get());
            x1 = tl.getX() + rpx;
            y1 = tl.getY() + rpy;
            x2 = tr.getX() + rpx;
            y2 = tr.getY() + rpy;
            x3 = br.getX() + rpx;
            y3 = br.getY() + rpy;
            x4 = bl.getX() + rpx;
            y4 = bl.getY() + rpy;
        }

        int cnt = 0;
        if (isPointIntersectsLine(x, y, x1, y1, x2, y2)) {
            cnt++;
View Full Code Here

        int bx = 0;
        int by = 0;
        int bw = mw;
        int bh = mh;

        Point2D tl = new Point2D(0, 0);
        Point2D tr = new Point2D(mw, 0);
        Point2D br = new Point2D(mw, mh);
        Point2D bl = new Point2D(0, mh);

        int cx = (int) (mw * tcx);
        int cy = (int) (mh * tcy);

        double rot = rotate.get();
        if (rot != 0.0) {
            tl = rotatePoint(cx, cy, 0, 0, rot);
            tr = rotatePoint(cx, cy, bw, 0, rot);
            br = rotatePoint(cx, cy, bw, bh, rot);
            bl = rotatePoint(cx, cy, 0, bh, rot);
        }

        double sx = scaleX.get();
        double sy = scaleY.get();

        if (sx != 1.0 || sy != 1.0) {
            tl = scalePoint(cx, cy, tl.getX(), tl.getY(), sx, sy);
            tr = scalePoint(cx, cy, tr.getX(), tr.getY(), sx, sy);
            br = scalePoint(cx, cy, br.getX(), br.getY(), sx, sy);
            bl = scalePoint(cx, cy, bl.getX(), bl.getY(), sx, sy);
        }

        int minX = Math.min(Math.min(tl.getX(), tr.getX()), Math.min(br.getX(), bl.getX()));
        int minY = Math.min(Math.min(tl.getY(), tr.getY()), Math.min(br.getY(), bl.getY()));
        int maxX = Math.max(Math.max(tl.getX(), tr.getX()), Math.max(br.getX(), bl.getX()));
        int maxY = Math.max(Math.max(tl.getY(), tr.getY()), Math.max(br.getY(), bl.getY()));
        bw = maxX - minX;
        bh = maxY - minY;
        bx = minX;
        by = minY;

View Full Code Here

    }

    private Point2D scalePoint(int centerX, int centerY, int pointX, int pointY, double scaleX, double scaleY) {
        int resX = (int) (centerX + ((pointX - centerX) * scaleX));
        int resY = (int) (centerY + ((pointY - centerY) * scaleY));
        return new Point2D(resX, resY);
    }
View Full Code Here

        int rx = (int) ((cos * x) - (sin * y));
        int ry = (int) ((sin * x) + (cos * y));
        rx = rx + cx;
        ry = ry + cy;

        return new Point2D(rx, ry);
    }
View Full Code Here

        // rotatePoints
        if (rotate.get() != 0.0) {
            int rpx = (int) (x1 + ((x2 - x1) * transformCenterX.get()));
            int rpy = (int) (y1 + ((y4 - y1) * transformCenterX.get()));
            Point2D tl = rotatePoint(0, 0, x1 - rpx, y1 - rpy, rotate.get());
            Point2D tr = rotatePoint(0, 0, x2 - rpx, y2 - rpy, rotate.get());
            Point2D br = rotatePoint(0, 0, x3 - rpx, y3 - rpy, rotate.get());
            Point2D bl = rotatePoint(0, 0, x4 - rpx, y4 - rpy, rotate.get());
            x1 = tl.getX() + rpx;
            y1 = tl.getY() + rpy;
            x2 = tr.getX() + rpx;
            y2 = tr.getY() + rpy;
            x3 = br.getX() + rpx;
            y3 = br.getY() + rpy;
            x4 = bl.getX() + rpx;
            y4 = bl.getY() + rpy;
        }

        int cnt = 0;
        if (isPointIntersectsLine(x, y, x1, y1, x2, y2)) {
            cnt++;
View Full Code Here

                    if (child.isIntersectsPoint(parentX, parentY)) {
                        int left = child.getLeft() + child.translateXProperty().get();
                        int top = child.getTop() + child.translateYProperty().get();
                        int tcx = (int) (left + child.measuredWidthProperty().get() * child.transformCenterXProperty().get());
                        int tcy = (int) (top + child.measuredHeightProperty().get() * child.transformCenterYProperty().get());
                        Point2D childPoint = rotatePoint(tcx, tcy, parentX, parentY, -child.rotateProperty().get());
                        int childX = childPoint.getX();
                        int childY =childPoint.getY();
                        childX = childX - left;
                        childY = childY - top;
                        // TODO scale back point
                        if (child.doPointerEventClimbingUp(screenX, screenY, childX, childY, wheelVelocity,
                                altPressed, ctrlPressed, shiftPressed, metaPressed, type)) {
View Full Code Here

        int rx = (int) ((cos * x) - (sin * y));
        int ry = (int) ((sin * x) + (cos * y));
        rx = rx + cx;
        ry = ry + cy;
       
        return new Point2D(rx, ry);
    }
View Full Code Here

TOP

Related Classes of com.eagerlogic.cubee.client.utils.Point2D

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.