Examples of Line2D


Examples of java.awt.geom.Line2D

        CropBounds oldCrop, Rectangle2D underlay
    ) {
        if (underlayContains(oldCrop, underlay)) {
            return oldCrop;
        }
        Line2D east = getEastCropLine(oldCrop);
        Point2D midEast = new Point2D.Double(
            (east.getP1().getX() + east.getP2().getX()) / 2,
            (east.getP1().getY() + east.getP2().getY()) / 2
        );
        Line2D neLine = new Line2D.Double(midEast, oldCrop.getUpperRight());
        Line2D nwLine = new Line2D.Double(midEast, oldCrop.getUpperLeft());
        Line2D seLine = new Line2D.Double(midEast, oldCrop.getLowerRight());
        Line2D swLine = new Line2D.Double(midEast, oldCrop.getLowerLeft());

        LinkedList<Line2D> lines = new LinkedList<Line2D>();
        lines.add(nwLine);
        lines.add(swLine);
        double oldDiagonalScale = midEast.distance(oldCrop.getUpperLeft());
View Full Code Here

Examples of java.awt.geom.Line2D

        if (underlayContains(oldCrop, underlay)) {
            return oldCrop;
        }
        Point2D sw = oldCrop.getLowerLeft();
        Point2D ne = oldCrop.getUpperRight();
        Line2D diagonal = new Line2D.Double(sw, ne);

        double oldDiag = sw.distance(ne);
        double newDiag = getMinimumDistance(
            sw, Collections.singleton(diagonal), underlay
        );
        double diagScale = newDiag / oldDiag;

        Point2D se = oldCrop.getLowerRight();
        Line2D south = getSouthCropLine(oldCrop);

        double oldSouth = sw.distance(se);
        double newSouth = getMinimumDistance(
            sw, Collections.singleton(south), underlay
        );
        double southScale = newSouth / oldSouth;

        Point2D nw = oldCrop.getUpperLeft();
        Line2D west = getWestCropLine(oldCrop);

        double oldWest = sw.distance(nw);
        double newWest = getMinimumDistance(
            sw, Collections.singleton(west), underlay
        );
View Full Code Here

Examples of java.awt.geom.Line2D

        if (underlayContains(oldCrop, underlay)) {
            return oldCrop;
        }
        Point2D se = oldCrop.getLowerRight();
        Point2D nw = oldCrop.getUpperLeft();
        Line2D diagonal = new Line2D.Double(se, nw);

        double oldDiag = se.distance(nw);
        double newDiag = getMinimumDistance(
            se, Collections.singleton(diagonal), underlay
        );
        double diagScale = newDiag / oldDiag;

        Point2D sw = oldCrop.getLowerLeft();
        Line2D south = getSouthCropLine(oldCrop);

        double oldSouth = sw.distance(se);
        double newSouth = getMinimumDistance(
            se, Collections.singleton(south), underlay
        );
        double southScale = newSouth / oldSouth;

        Point2D ne = oldCrop.getUpperRight();
        Line2D east = getEastCropLine(oldCrop);

        double oldEast = se.distance(ne);
        double newEast = getMinimumDistance(
            se, Collections.singleton(east), underlay
        );
View Full Code Here

Examples of java.awt.geom.Line2D

        if (underlayContains(oldCrop, underlay)) {
            return oldCrop;
        }
        Point2D se = oldCrop.getLowerRight();
        Point2D nw = oldCrop.getUpperLeft();
        Line2D diagonal = new Line2D.Double(se, nw);

        double oldDiag = se.distance(nw);
        double newDiag = getMinimumDistance(
            nw, Collections.singleton(diagonal), underlay
        );
        double diagScale = newDiag / oldDiag;

        Point2D ne = oldCrop.getUpperRight();
        Line2D north = getNorthCropLine(oldCrop);

        double oldNorth = nw.distance(ne);
        double newNorth = getMinimumDistance(
            nw, Collections.singleton(north), underlay
        );
        double northScale = newNorth / oldNorth;

        Point2D sw = oldCrop.getLowerLeft();
        Line2D west = getWestCropLine(oldCrop);

        double oldWest = sw.distance(nw);
        double newWest = getMinimumDistance(
            nw, Collections.singleton(west), underlay
        );
View Full Code Here

Examples of java.awt.geom.Line2D

        if (underlayContains(oldCrop, underlay)) {
            return oldCrop;
        }
        Point2D sw = oldCrop.getLowerLeft();
        Point2D ne = oldCrop.getUpperRight();
        Line2D diagonal = new Line2D.Double(sw, ne);

        double oldDiag = sw.distance(ne);
        double newDiag = getMinimumDistance(
            ne, Collections.singleton(diagonal), underlay
        );
        double diagScale = newDiag / oldDiag;

        Point2D nw = oldCrop.getUpperLeft();
        Line2D north = getNorthCropLine(oldCrop);

        double oldNorth = nw.distance(ne);
        double newNorth = getMinimumDistance(
            ne, Collections.singleton(north), underlay
        );
        double northScale = newNorth / oldNorth;

        Point2D se = oldCrop.getLowerRight();
        Line2D east = getEastCropLine(oldCrop);

        double oldEast = ne.distance(se);
        double newEast = getMinimumDistance(
            ne, Collections.singleton(east), underlay
        );
View Full Code Here

Examples of java.awt.geom.Line2D

    // intersection between any of the given lines and the underlay rectangle.
    // If none of the lines intersect the underlay, returns -1;
    private static double getMinimumDistance(
        Point2D p, Collection<Line2D> lines, Rectangle2D underlay
    ) {
        Line2D top = getTopUnderlayLine(underlay);
        Line2D left = getLeftUnderlayLine(underlay);
        Line2D bottom = getBottomUnderlayLine(underlay);
        Line2D right = getRightUnderlayLine(underlay);

        LinkedList<Point2D> intersections = new LinkedList<Point2D>();

        for (Line2D line : lines) {
View Full Code Here

Examples of java.awt.geom.Line2D

        }
        return false;
    }

    private static double getMinimumDistance(Point2D p, Rectangle2D underlay) {
        Line2D top = getTopUnderlayLine(underlay);
        Line2D bottom = getBottomUnderlayLine(underlay);
        Line2D left = getLeftUnderlayLine(underlay);
        Line2D right = getRightUnderlayLine(underlay);

        double dist = top.ptLineDist(p);
        dist = Math.min(dist, bottom.ptLineDist(p));
        dist = Math.min(dist, left.ptLineDist(p));
        dist = Math.min(dist, right.ptLineDist(p));

        return dist;
    }
View Full Code Here

Examples of java.awt.geom.Line2D

        CropBounds oldCrop, Rectangle2D underlay
    ) {
        if (underlayContains(oldCrop, underlay)) {
            return oldCrop;
        }
        Line2D top = getTopUnderlayLine(underlay);
        Line2D left = getLeftUnderlayLine(underlay);
        Line2D bottom = getBottomUnderlayLine(underlay);
        Line2D right = getRightUnderlayLine(underlay);

        Line2D north = getNorthCropLine(oldCrop);
        Line2D south = getSouthCropLine(oldCrop);
        Line2D east = getEastCropLine(oldCrop);
        Line2D west = getWestCropLine(oldCrop);

        Point2D et = getIntersection(east, top);
        Point2D el = getIntersection(east, left);
        Point2D eb = getIntersection(east, bottom);
        Point2D er = getIntersection(east, right);
View Full Code Here

Examples of java.awt.geom.Line2D

        CropBounds oldCrop, Rectangle2D underlay
    ) {
        if (underlayContains(oldCrop, underlay)) {
            return oldCrop;
        }
        Line2D top = getTopUnderlayLine(underlay);
        Line2D left = getLeftUnderlayLine(underlay);
        Line2D bottom = getBottomUnderlayLine(underlay);
        Line2D right = getRightUnderlayLine(underlay);

        Line2D north = getNorthCropLine(oldCrop);
        Line2D south = getSouthCropLine(oldCrop);
        Line2D east = getEastCropLine(oldCrop);
        Line2D west = getWestCropLine(oldCrop);

        Point2D et = getIntersection(east, top);
        Point2D el = getIntersection(east, left);
        Point2D eb = getIntersection(east, bottom);
        Point2D er = getIntersection(east, right);
View Full Code Here

Examples of java.awt.geom.Line2D

        CropBounds oldCrop, Rectangle2D underlay
    ) {
        if (underlayContains(oldCrop, underlay)) {
            return oldCrop;
        }
        Line2D top = getTopUnderlayLine(underlay);
        Line2D left = getLeftUnderlayLine(underlay);
        Line2D bottom = getBottomUnderlayLine(underlay);
        Line2D right = getRightUnderlayLine(underlay);

        Line2D north = getNorthCropLine(oldCrop);
        Line2D south = getSouthCropLine(oldCrop);
        Line2D east = getEastCropLine(oldCrop);
        Line2D west = getWestCropLine(oldCrop);

        Point2D nt = getIntersection(north, top);
        Point2D nl = getIntersection(north, left);
        Point2D nb = getIntersection(north, bottom);
        Point2D nr = getIntersection(north, right);

        Point2D st = getIntersection(south, top);
        Point2D sl = getIntersection(south, left);
        Point2D sb = getIntersection(south, bottom);
        Point2D sr = getIntersection(south, right);

        double width = oldCrop.getWidth();

        if (nt != null) {
            width = minIgnoreNegative(width, west.ptLineDist(nt));
        }
        if (nl != null) {
            width = minIgnoreNegative(width, west.ptLineDist(nl));
        }
        if (nb != null) {
            width = minIgnoreNegative(width, west.ptLineDist(nb));
        }
        if (nr != null) {
            width = minIgnoreNegative(width, west.ptLineDist(nr));
        }
        if (st != null) {
            width = minIgnoreNegative(width, west.ptLineDist(st));
        }
        if (sl != null) {
            width = minIgnoreNegative(width, west.ptLineDist(sl));
        }
        if (sb != null) {
            width = minIgnoreNegative(width, west.ptLineDist(sb));
        }
        if (sr != null) {
            width = minIgnoreNegative(width, west.ptLineDist(sr));
        }
        Point2D oldCenter = oldCrop.getCenter();
        double angle = oldCrop.getAngle();
        double height = oldCrop.getHeight();
        double dw = width - oldCrop.getWidth();
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.