Package java.awt.geom

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


    double x = det(det1And2, x1LessX2, det3And4, x3LessX4) / det1Less2And3Less4;
    double y = det(det1And2, y1LessY2, det3And4, y3LessY4) / det1Less2And3Less4;
    Point2D inter = new Point2D.Double(x, y);

    return inter.distance(oneS) < MaxDistIntersec;

  }

  public static boolean areSegmentSegmentIntersected(Point2D As, Point2D Ae,
      Point2D Bs, Point2D Be) {
View Full Code Here


        Point2D lastPoint = dest;
        Point2D newestPoint = justBeforeDestination;

        // Check that this ray subpath is long enough to be considered
        if (newestPoint.distance(lastPoint) < 0.01 && type != RayData.RayType.ORIGIN) {
          pathBroken = true;
        }

        // Subpath must be double-direct if from diffraction
        if (type == RayData.RayType.DIFFRACTION && !isDirectPath(lastPoint, newestPoint)) {
View Full Code Here

            switch (paintType) {
            default:
            case BASIC:
            case LINEAR:
                // pick the closest point to move
                if (inv.distance(startX, startY) < inv.distance(endX, endY)) {
                    startX = x;
                    startY = y;
                } else {
                    endX = x;
                    endY = y;
View Full Code Here

            switch (paintType) {
            default:
            case BASIC:
            case LINEAR:
                // pick the closest point to move
                if (inv.distance(startX, startY) < inv.distance(endX, endY)) {
                    startX = x;
                    startY = y;
                } else {
                    endX = x;
                    endY = y;
View Full Code Here

                }
                break;

            case RADIAL:
                // pick the closest point to move
                if (inv.distance(ctrX, ctrY) < inv.distance(focusX, focusY)) {
                    ctrX = x;
                    ctrY = y;
                } else {
                    focusX = x;
                    focusY = y;
View Full Code Here

                }
                break;

            case RADIAL:
                // pick the closest point to move
                if (inv.distance(ctrX, ctrY) < inv.distance(focusX, focusY)) {
                    ctrX = x;
                    ctrY = y;
                } else {
                    focusX = x;
                    focusY = y;
View Full Code Here

  @Override
  public boolean isCollidingWith(CollisionDetectable otherObj) {

    Point2D otherCentre = otherObj.getCentre();
    double distanceBetweenCentres = otherCentre.distance(getCentre());

    double totalRadii = getRadius() + otherObj.getRadius();

    return (distanceBetweenCentres < totalRadii);
  }
View Full Code Here

  @Override
  public boolean isCollidingWith(CollisionDetectable otherObj) {

    Point2D otherCentre = otherObj.getCentre();
    double distanceBetweenCentres = otherCentre.distance(getCentre());

    double totalRadii = getRadius() + otherObj.getRadius();

    return (distanceBetweenCentres < totalRadii);
  }
View Full Code Here

    shape = new Rectangle2DExt(location.x-10,location.y-10,20,20);

    //Find the point on the edge where the accident happens relative to the edge starting point
    Point2D edgeStartingPoint = edge.getLanes().get(0).GetPoint(0);
     
    double relativeLocation = Math.min(edgeStartingPoint.distance(this.location),edge.getLength());
   
    if(relativeLocation>edge.getLength()){
      edgeRelativeLocation = edge.getLength()/2f;
    }
    else{
View Full Code Here

      Point2D[] points = ((ArcModel) selectedCell).getPoints();
      double minDist = Double.MAX_VALUE;
      int pos = -1;
      for (int i = 1; i < points.length - 1; i++)
      {
        if (clickPoint.distance(points[i]) < minDist)
        {
          pos = i;
          minDist = clickPoint.distance(points[i]);
        }
      }
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.