# Visual angle (dva) to pixel conversion in EventIDE

363 views
We're trying to use EventIDE in parallel with a software we wrote in-house. We just wanted to know the exact formula used to convert the dva eccentricity to pixel coordinates in order to have the same pixel values in both programs (EventIDE uses the monitor diagonal length in cm and the distance to screen).

answered Jul 19, 2016 by (12,700 points)

First, EventIDE estimates how many DVA is in 1 cm of the screen surface given the monitor distance:

double DVAInOneCM = 2 * Atan(1.0 / (2.0 * MonitorDistance)) * 180.0 / PI

Second, it estimates the diagonal length of the monitor area in pixels, given the selected screen resolution in pixels:

double MonitorDiagonalInPixels = Math.Sqrt(Math.Pow(ScreenPixelWidth, 2) + Math.Pow(ScreenPixelHeight, 2))

Finally, the conversion ratio, as a number of pixels in 1 DVA,  is derived from the above values and the monitor diagonal:

Ratio = (MonitorDiagonalInPixels / MonitorDiagonalInCM) / DVAInOneCM;

The ratio is then used in all pixel<->DVA conversions for X and Y, for instance in conversion from  the centered dva coordinates to the centered pixels coordinates:

Ypix = Ydva * Ratio + ScreenPixelHeight / 2.0;