Package java.awt

Examples of java.awt.Point.distance()


    Map2DUtils.line(start.x, start.y, end.x, end.y, pts);

    Point previous = pts.get(0);
    for (int i = 0; i < pts.size(); ++i) {
      Point next = pts.get(i);
      if (next.distance(previous) > 1) {
        pts.add(i, new Point(previous.x, next.y));
        i++;
      }
      previous = next;
    }
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

    }

    public void nextFrame() {
        if (Status.startsWith("Moving")) {
            Point Now = this.getLocation();
            if (Now.distance(To.x, To.y) != 0) {
                if (To.x - From.x != 0) {
                    int newX = Now.x + (Utility.sgn(To.x - Now.x));
                    int NewY = (int) Math.round(-Teta * (newX - To.x) + To.y);
                    //int NewY= p.y + (Utility.sgn(j));
                    this.setLocation(newX, NewY);
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

      // 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

       
        for(int i=1;i<NB_NOEUDS;i++)
        {
            n = noeuds[i];
           
            distance = cible.distance(n);
           
            if(distance < distMax)
            {
                iNoeudLePlusProche = i;
                distMax = distance;
View Full Code Here

    Point farestPoint = points.get(0);
    for (Point point : points)
      farestPoint = ((int) points.get(0).distance(point) > (int)points.get(0).distance(farestPoint)) ? point : farestPoint;

    Point center = CircleGesture.segmentMiddle(points.get(0), farestPoint);
    int radius = (int) center.distance(points.get(0));
   
    if (radius < CircleGesture.MINIMAL_RADIUS || radius > CircleGesture.MAXIMAL_RADIUS)
      return false;

    for (Point point : points) {
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.