Here you can find the source of angle2pixels(double angle)
Parameter | Description |
---|---|
angle | the visual angle in degrees |
public static double angle2pixels(double angle)
//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 ww .j ava 2 s . co m * Converts a value from visual angle to pixels on the standard display. * * @param angle * the visual angle in degrees * @return the value in pixels */ public static double angle2pixels(double angle) { return viewingDistance * Math.tan(deg2rad(angle)) * pixelsPerInch; } /** * Converts a value from degrees to radians. * * @param degrees * the value in degrees * @return the value in radians */ public static double deg2rad(double degrees) { return degrees * (Math.PI / 180.0); } }