Java Distance Calculate distance2(float x, float y, float x1, float y1)

Here you can find the source of distance2(float x, float y, float x1, float y1)

Description

Return the distance squared between two points.

License

Open Source License

Declaration

public static float distance2(float x, float y, float x1, float y1) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*  w ww.  java 2s.co  m*/
     * Return the distance squared between two points.
     */
    public static float distance2(float x, float y, float x1, float y1) {
        x = (float) Math.pow(x - x1, 2);
        y = (float) Math.pow(y - y1, 2);
        return (x + y);
    }

    public static float distance2(float[] p1, float x, float y) {
        return distance2(p1[0], p1[1], x, y);
    }
}

Related

  1. distance(int xa, int ya, int xb, int yb)
  2. distance(int[] a, int[] b)
  3. distance(String a, String b)
  4. distance(String coord1, String coord2, char unit)
  5. distance(String seq1, String seq2)
  6. distance2(float x1, float y1, float x2, float y2)
  7. distance2(int x1, int y1, int x2, int y2)
  8. distance2d(double x1, double y1, double x2, double y2)
  9. distance2D(double x1, double z1, double x2, double z2)