Java Euclidean Distance euclideanDistance(float[] points, int p1, int p2, boolean isDisp, double width, double height)

Here you can find the source of euclideanDistance(float[] points, int p1, int p2, boolean isDisp, double width, double height)

Description

euclidean Distance

License

Open Source License

Declaration

private static double euclideanDistance(float[] points, int p1, int p2, boolean isDisp, double width,
            double height) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2016 Weasis Team and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from   w ww . jav  a2  s .  c om*/
 *     Nicolas Roduit - initial API and implementation
 *******************************************************************************/

public class Main {
    private static double euclideanDistance(float[] points, int p1, int p2, boolean isDisp, double width,
            double height) {
        float dx = points[p1] - points[p2];
        float dy = points[p1 + 1] - points[p2 + 1];
        if (isDisp) {
            dx *= width;
            dy *= height;
        }
        return Math.sqrt(dx * dx + dy * dy);
    }
}

Related

  1. euclideanDistance(double[] data, double[] pattern)
  2. euclideanDistance(double[] l1, double[] l2, boolean weighted)
  3. euclideanDistance(double[] p, double[] q)
  4. euclideanDistance(double[] vector)
  5. euclideanDistance(double[] vector1, double[] vector2)
  6. euclideanDistance(int i0, int j0, int i1, int j1)
  7. euclideanDistance(int startX, int startY, int startZ, int endX, int endY, int endZ)
  8. euclideanDistanceNorm(float[] x, float[] y)
  9. euclideanDistanceSq2D(float x1, float y1, float x2, float y2)