Examples of Point2D


Examples of java.awt.geom.Point2D

        if (r < FLT_EPSILON)
            return A;
        if (1 - r < FLT_EPSILON)
            return B;

        Point2D P = new Point2D.Double(r * B.getX() + (1 - r) * A.getX(), r
                * B.getY() + (1 - r) * A.getY());
        return P;
    }
View Full Code Here

Examples of java.awt.geom.Point2D

    protected static boolean retrievePoints(float length, LinkedList points,
                                            LinkedList polysegment) {
        polysegment.clear();

        // first point
        Point2D point = (Point2D) points.removeFirst();
        ;
        polysegment.add(point);

        double consumedLength = 0.0;
        double norm = 0.0;
        Point2D nextPoint = null;

        while (consumedLength < length && points.size() > 0) {
            // consume points while distance is not reached
            nextPoint = (Point2D) points.removeFirst();
            polysegment.add(nextPoint);
            norm = LineUtil.norm(point, nextPoint);
            consumedLength += norm;
            point = nextPoint;
        }

        if (consumedLength == length) {
            // we got the exact distance with an existing point.
            // we need to copy the last point back: it will be the
            // first for the next call
            points.addFirst(point);
            return true;
        } else {
            if (consumedLength > length) {
                // we went too far, we need to put back the last point
                points.addFirst(polysegment.removeLast());
                consumedLength -= norm;
                // and interpolate a new point
                point = (Point2D) polysegment.getLast();
                double d = length - consumedLength;
                // between point and nextPoint at distance d
                Point2D interp = LineUtil.interpolatedPoint(point, nextPoint, d);
                polysegment.add(interp);
                points.addFirst(interp);
                return true;
            } else {
                // no more points !
View Full Code Here

Examples of java.awt.geom.Point2D

        }

        LinkedList polysegment = new LinkedList();
        int l, x1, y1, x2, y2;
        String c;
        Point2D p1, p2;
        double angle;
        for (int i = 0; i < text.length(); i++) {
            c = text.substring(i, i + 1);
            l = metrics.stringWidth(c);
            if (points.size() == 0)
                break;
            LineUtil.retrievePoints(l, points, polysegment);

            p1 = (Point2D) polysegment.getFirst();
            x1 = (int) p1.getX();
            y1 = (int) p1.getY();
            p2 = (Point2D) polysegment.getLast();
            x2 = (int) p2.getX();
            y2 = (int) p2.getY();

            angle = Math.atan2(y2 - y1, x2 - x1);
View Full Code Here

Examples of java.awt.geom.Point2D

        PathIterator pi = s.getPathIterator(null, FLATNESS);
        int segType;
        double[] segCoords = new double[6];

        LinkedList points = new LinkedList();
        Point2D firstPoint = null;
        Point2D point;

        // split path in polylines
        do {
            segType = pi.currentSegment(segCoords);
            point = new Point2D.Double(segCoords[0], segCoords[1]);
View Full Code Here

Examples of java.awt.geom.Point2D

        locationCenterXPixel = ((double) getWidth() / 2d);
        locationCenterYPixel = ((double) getHeight() / 2d);
       
        locationPixelsPerLambert = (double)getPPM() / getScale();
       
        Point2D lp = new Point2D.Double();
        LatLonPoint origin = new LatLonPoint(referenceLatitude, centralMeridian);
        LLToWorld(origin.getLatitude(), origin.getLongitude(), lp);
        locationOriginX = lp.getX();
        locationOriginY = lp.getY();
       
        LatLonPoint center = getCenter();
        LLToWorld(center.getLatitude(), center.getLongitude(), lp);
        locationCenterXLambert = lp.getX();
        locationCenterYLambert = lp.getY();
       
        if (Debug.debugging("Lambert")) {
            Debug.output("Creating LambertConformal: center x = "
                    + locationCenterXLambert + ", center y = "
                    + locationCenterYLambert);
View Full Code Here

Examples of java.awt.geom.Point2D

     * DESCRIPTION:  This function converts lat, lon coordinate to pixel
     *               coordinate.
     *--------------------------------------------------------------------------*/
   
    public Point LLToPixel(double lat, double lon, Point p) {
        Point2D lp = new Point2D.Double();
       
        LLToWorld(lat, lon, lp);
       
        double xrel = lp.getX() - locationCenterXLambert;
        double yrel = lp.getY() - locationCenterYLambert;
       
        xrel = (xrel * locationPixelsPerLambert);
        yrel = (yrel * locationPixelsPerLambert);
       
        xrel = locationCenterXPixel + xrel;
View Full Code Here

Examples of java.awt.geom.Point2D

        // the same earth radius up north..

        double widthPX = point2.x - point1.x;
        double heightPX = point2.y - point1.y;
       
        Point2D xx1 = LLToWorld(ll1.getLatitude(), ll1.getLongitude(), new Point2D.Double());
        Point2D xx2 = LLToWorld(ll2.getLatitude(), ll2.getLongitude(), new Point2D.Double());

        double widthMap = (xx2.getX() - xx1.getX());
        double widthScale = (((double) getPPM()) * (widthMap / widthPX));

        double heightMap = (xx2.getY() - xx1.getY());
        double heightScale = (((double) getPPM()) * (heightMap / heightPX));
       
        // TODO: use width-, height- or medium scale?

        return (float)widthScale;
View Full Code Here

Examples of java.awt.geom.Point2D

        Debug.message("Lambert", "(1)" + proj.inverse(310, 240));
       
        LatLonPoint llp = new LatLonPoint(0.0f, 0.0f);
        Debug.message("Lambert", "(2)" + proj.worldToLL(251763.20f, 153034.13f, llp));
       
        Point2D lp = new Point2D.Double();
        LatLonPoint pt = new LatLonPoint(50.679572292f, 5.807370150f);
        Debug.message("Lambert", "(3)" + proj.LLToWorld(pt.getLatitude(), pt.getLongitude(), lp));
    }
View Full Code Here

Examples of java.awt.geom.Point2D

    /**
     * Return a LatLonPoint in WGS 84
     */
    public LatLonPoint getLatLon(LatLonPoint instance) {
      Point2D p = getLatLon(Ellipsoid.WGS_84, null);
      instance.setLatLon(p.getY(), p.getX());
      return instance;
    }
View Full Code Here

Examples of java.awt.geom.Point2D

   */
  private String cxy(double x, double y) {
//    double nx = x, ny = y; // scratch
//    double mh = page.getPageFormat().getHeight();

    Point2D ptSrc = new Point2D.Double(x, y);
    Point2D ptDst = new Point2D.Double();
    transform.transform(ptSrc, ptDst);

//    x += trax;
//    y += tray;
//
//    nx = x;
//    ny = mh - y;
//
//    System.out.println("\ncxy(" + ptSrc.getX() + ", " + ptSrc.getY() + ")");
//    System.out.println("Old [" + nx + "," + ny + "]");
//    System.out.println("Trn [" + ptDst.getX() + ", " + ptDst.getY() + "]");
//
//    return "" + df.format(nx) + " " + df.format(ny) + " ";
    return ""+df.format(ptDst.getX())+" "+df.format(ptDst.getY())+" ";
     
  }
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.