Package java.awt

Examples of java.awt.Point.distance()


   
    if (radius < CircleGesture.MINIMAL_RADIUS || radius > CircleGesture.MAXIMAL_RADIUS)
      return false;

    for (Point point : points) {
      if (center.distance(point) < (radius - Gesture.shakiness))
        return false;
      if (center.distance(point) > (radius + Gesture.shakiness))
        return false;
    }
View Full Code Here


      return false;

    for (Point point : points) {
      if (center.distance(point) < (radius - Gesture.shakiness))
        return false;
      if (center.distance(point) > (radius + Gesture.shakiness))
        return false;
    }

    return true;
  }
View Full Code Here

      Point center = getCenter(link.getSource());
      double theta = Math.atan2(center.y-getHeight()/2, center.x-getWidth()/2);
      Point start = circumferenceOnAngle(center, theta-0.3);
      Point end = circumferenceOnAngle(center, theta+0.3);
      Point arcCenter = new Point((start.x+end.x)/2, (start.y+end.y)/2);
      int arcRadius = (int) arcCenter.distance(end);
      int thetaDeg = (int) (-theta*180/Math.PI);
      g.drawArc(arcCenter.x-arcRadius, arcCenter.y-arcRadius, 2*arcRadius, 2*arcRadius, thetaDeg-90, 180);
      g.setColor(ovalColor);
      g.fillOval(end.x-CONNECTIONDOTRADIUS, end.y-CONNECTIONDOTRADIUS, 2*CONNECTIONDOTRADIUS, 2*CONNECTIONDOTRADIUS);
    }
 
View Full Code Here

            Point nodeCoords = notesCoords[i][j];
            if (nodeCoords == null) {
              continue;
            }

            if (nodeCoords.distance(x, y) < 10) {
              JOptionPane.showMessageDialog(
                  DotDiagram.this,
                  notes[i][j],
                  "Log message", JOptionPane.INFORMATION_MESSAGE);
            }
View Full Code Here

                return; // still selecting nodes, not yet moving them
            }
            Point p = e.getPoint();
            // Checks if we have moved a minimum of a few pixels before actually starting a move.
            // This is useful to prevent slight moves when you select a node by clicking on it.
            if ( !isMoving && p.distance(movePoint) < 5 ) {
                return;
            }
            if (!isDragSelecting && (e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) == MouseEvent.SHIFT_DOWN_MASK) {
              isDragSelecting = true;
            }
View Full Code Here

      // Determine if there is too much overlap with other animals
      final double tooClose = new Point(width, height).distance(new Point(0, 0)) / 2.0;
      boolean tooMuchOverlap = false;
      for (final PlacedAnimal animal : animals)
      {
        if (point.distance(animal.location) < tooClose)
        {
          tooMuchOverlap = true;
          break;
        }
      }
View Full Code Here

      // Determine if there is too much overlap with other animals
      final double tooClose = new Point(width, height).distance(new Point(0, 0)) / 2.0;
      boolean tooMuchOverlap = false;
      for (final PlacedAnimal animal : animals)
      {
        if (point.distance(animal.location) < tooClose)
        {
          tooMuchOverlap = true;
          break;
        }
      }
View Full Code Here

        Arrays.fill(data, 0);
        for (int i = 0; i < 4; i++) {
            Point p = state.transformPoint(pa[i], ctm);

            int length = (int) p.distance(0, 0);
            if (p.x == 0 && p.y > 0) {
                data[UP] = length;
            } else if (p.x == 0 && p.y < 0) {
                data[DOWN] = length;
            } else if (p.x > 0 && p.y == 0) {
View Full Code Here

    @Override public void mouseDragged(MouseEvent ev) {
        if (mouseStart == null || mousePos == null) return;
        if ((ev.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == 0) return;
        Point p = ev.getPoint();
        if (! dragging) {
            if (p.distance(mouseStart) < 3) return;
            playHeadMarker.startDrag();
            dragging = true;
        }
        if (p.distance(mousePos) == 0) return;
        playHeadMarker.drag(Main.map.mapView.getEastNorth(ev.getX(), ev.getY()));
View Full Code Here

        if (! dragging) {
            if (p.distance(mouseStart) < 3) return;
            playHeadMarker.startDrag();
            dragging = true;
        }
        if (p.distance(mousePos) == 0) return;
        playHeadMarker.drag(Main.map.mapView.getEastNorth(ev.getX(), ev.getY()));
        mousePos = p;
    }

    @Override public void mouseReleased(MouseEvent ev) {
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.