Package java.awt.geom

Examples of java.awt.geom.Point2D.distance()


        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;
View Full Code Here


        hoverPoint = cursor;
        showAddIndicator = true;
        hoverStop = null;
        for(MultiGradientFill.Stop stop: getFill().getStops()) {
            Point2D pt = Util.interpolatePoint(getStart(), getEnd(), stop.getPosition());
            if(pt.distance(cursor) < 10) {
                showAddIndicator = false;
                hoverStop = stop;
            }
        }
    }
View Full Code Here

        Point2D end = getEnd();

        //check if starting to drag a stop
        for(MultiGradientFill.Stop stop: getFill().getStops()) {
            Point2D pt = Util.interpolatePoint(start,end,stop.getPosition());
            if(pt.distance(cursor) < 5) {
                onStop = true;
                activeStop = stop;
                return;
            }
        }
View Full Code Here

                draggingStop = true;
            }
        }
        if(onStop) {
            Point2D stopPoint = Util.interpolatePoint(getStart(),getEnd(),activeStop.getPosition());
            double d = stopPoint.distance(cursor);
            if(d > 20) {
                couldDelete = true;
            } else {
                couldDelete = false;
            }
View Full Code Here

            update(constrain);
        }

        private void update(boolean constrain) {
            Point2D center = new Point2D.Double(node.getTranslateX(),node.getTranslateY());
            double radius = center.distance(x,y);
            if(outer) {
                node.setRadius(radius);
            } else {
                node.setInnerRadius(radius);
            }
View Full Code Here

        u.startTimer();
        int transparent = new Color(0,0,0,0).getRGB();
        for(int x=0; x<width; x++) {
            for(int y=0; y<height; y++) {
                Point2D pt = new Point(x,y);
                if(pt.distance(c) > width/2 || pt.distance(c) < width/2-ringWidth) {
                    img.setRGB(x,y,transparent);
                } else {
                    double angle = GeomUtil.calcAngle(c, pt);
                    int color = Color.HSBtoRGB((float) (angle/360f),1,1);
                    img.setRGB(x,y,color);
View Full Code Here

        u.startTimer();
        int transparent = new Color(0,0,0,0).getRGB();
        for(int x=0; x<width; x++) {
            for(int y=0; y<height; y++) {
                Point2D pt = new Point(x,y);
                if(pt.distance(c) > width/2 || pt.distance(c) < width/2-ringWidth) {
                    img.setRGB(x,y,transparent);
                } else {
                    double angle = GeomUtil.calcAngle(c, pt);
                    int color = Color.HSBtoRGB((float) (angle/360f),1,1);
                    img.setRGB(x,y,color);
View Full Code Here

    protected void testCubic(ArrayList quad_curves, CubicCurve2D curve)
    {
        Point2D cubic_mid_point = cubicMidPoint(curve);
        Point2D control         = getOneControlPoint(curve);
        Point2D quad_mid_point  = quadMidPoint(curve, control);
        double dist = quad_mid_point.distance( cubic_mid_point );

        if (dist > 0.5) // check if the cubic and quad curve overlapp
        {
            CubicCurve2D left  = new CubicCurve2D.Double();
            CubicCurve2D right = new CubicCurve2D.Double();
View Full Code Here

          XYItemEntity entity = (XYItemEntity) o;
          Rectangle2D itemBounds = entity.getArea().getBounds2D();
          Point2D centerPt = new Point2D.Double(itemBounds
              .getCenterX(), itemBounds.getCenterY());

          double dist = centerPt.distance(lastPointClicked);
          if (dist < closestDist) {
            closestDist = dist;
            lastDatasetSelected = entity.getDataset();
            lastObSelected = obsModel.getValidObservation(entity
                .getSeriesIndex(), entity.getItem());
View Full Code Here

      EdgeView edge = (EdgeView) view;
      Point2D last = null, current = null;
      for (int i = 0; i < edge.getPointCount(); i++) {
        current = edge.getPoint(i);
        if (last != null)
          cost += last.distance(current);
        last = current;
      }
    }
    return cost;
  }
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.