Java Pixel pixelSpacing(int n)

Here you can find the source of pixelSpacing(int n)

Description

pixel Spacing

License

Open Source License

Declaration

public static double pixelSpacing(int n) 

Method Source Code

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

public class Main {
    /**/*  w ww.  java2s .  c  o  m*/
     * Axial coordinates are a coordinate system referring to vertices of a triangular grid. The
     * grid is oriented such that triangle edges are horizontal (coincident with the x-axis) and at
     * +/-60 degrees. For a grid coordinate (u, v), u refers to coordinates increasing from the
     * origin in the line 60 degrees counter-clockwise from the +x axis, while v refers to
     * increasing along the x-axis.
     */

    static double SQRT_3 = Math.sqrt(3.);

    public static double pixelSpacing(int n) {
        // Even spacing across the panel gap. .5*SQRT_3 may be a better choice as it makes the density more
        // consistent across the gap (the gaps jump out less), but makes a bunch of other logic more complicated.
        double k = 1.;
        return 1. / (n - 1 + k * SQRT_3);
    }
}

Related

  1. pixel_distance(int x1, int y1, int x2, int y2)
  2. pixelRange(int p)
  3. pixelSize(double lat, double lng, int zoom)
  4. pixelsPerPanel(int n)
  5. pixelValuesEqual(final double num1, final double num2)