Java Distance Calculate distSymbol(int dist)

Here you can find the source of distSymbol(int dist)

Description

dist Symbol

License

Open Source License

Declaration

private static int distSymbol(int dist) 

Method Source Code

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

public class Main {
    private static int distSymbol(int dist) {
        if (dist < 193) {
            if (dist < 13) { /* dist 0..13. */
                if (dist < 5) {
                    return dist - 1;
                } else if (dist < 7) {
                    return 4;
                } else if (dist < 9) {
                    return 5;
                } else {
                    return 6;
                }//from  ww  w . j ava  2 s  .  co  m
            } else { /* dist 13..193. */
                if (dist < 17) {
                    return 7;
                } else if (dist < 25) {
                    return 8;
                } else if (dist < 33) {
                    return 9;
                } else if (dist < 49) {
                    return 10;
                } else if (dist < 65) {
                    return 11;
                } else if (dist < 97) {
                    return 12;
                } else if (dist < 129) {
                    return 13;
                } else {
                    return 14;
                }
            }
        } else {
            if (dist < 2049) { /* dist 193..2049. */
                if (dist < 257) {
                    return 15;
                } else if (dist < 385) {
                    return 16;
                } else if (dist < 513) {
                    return 17;
                } else if (dist < 769) {
                    return 18;
                } else if (dist < 1025) {
                    return 19;
                } else if (dist < 1537) {
                    return 20;
                } else {
                    return 21;
                }
            } else { /* dist 2049..32768. */
                if (dist < 3073) {
                    return 22;
                } else if (dist < 4097) {
                    return 23;
                } else if (dist < 6145) {
                    return 24;
                } else if (dist < 8193) {
                    return 25;
                } else if (dist < 12289) {
                    return 26;
                } else if (dist < 16385) {
                    return 27;
                } else if (dist < 24577) {
                    return 28;
                } else {
                    return 29;
                }
            }
        }
    }
}

Related

  1. distSqr2(double x1, double y1, double x2, double y2)
  2. distSquared(double ax, double ay, double bx, double by)
  3. distSquared(float x0, float y0, float x1, float y1)
  4. distSquaredCartesian(double[] vec1, double[] vec2)
  5. distSquareVec3(final float[] v1, final float[] v2)
  6. distToRectNode(double[] point, double[] nodeCenter, double nodeRadius)
  7. distUndermod(double a, double b, double mod)
  8. distVector(double[] vector1, double[] vector2)
  9. distVincentyRAD(double lat1, double lon1, double lat2, double lon2)