Java Pixel Convert To pixels2angle(double pixels)

Here you can find the source of pixels2angle(double pixels)

Description

Converts a value from pixels to visual angle on the standard display.

License

Open Source License

Parameter

Parameter Description
pixels the value in pixels

Return

the visual angle in degrees

Declaration

public static double pixels2angle(double pixels) 

Method Source Code

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

public class Main {
    /** The viewing distance to the screen, in inches. */
    public static double viewingDistance = 30;
    /** The value of pixels per inch on the standard display. */
    public static double pixelsPerInch = 72;

    /**//  w  w  w  . j  a v  a2 s.  co m
     * Converts a value from pixels to visual angle on the standard display.
     * 
     * @param pixels
     *            the value in pixels
     * @return the visual angle in degrees
     */
    public static double pixels2angle(double pixels) {
        return rad2deg(Math.atan2(pixels / pixelsPerInch, viewingDistance));
    }

    /**
     * Converts a value from radians to degrees.
     * 
     * @param radians
     *            the value in radians
     * @return the value in degrees
     */
    public static double rad2deg(double radians) {
        return radians * (180.0 / Math.PI);
    }
}

Related

  1. pixel2logical_size(float l, float zoom)
  2. pixel2WidthUnits(int pxs)
  3. pixels2Molecules(float[] pixels, int width, int height)
  4. pixelsToCm(float pixels)
  5. pixelsToInches(int sizeInPixels, int dpi)
  6. pixelsToPoint(int pixels, int dpi)