Here you can find the source of pixels2angle(double pixels)
Parameter | Description |
---|---|
pixels | the value in pixels |
public static double pixels2angle(double pixels)
//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); } }