mon_conv: Monitor Screen Unit Conversion

View source: R/mon_neat.R

mon_convR Documentation

Monitor Screen Unit Conversion

Description

Given a specific monitor object, converts specified screen units to other specified units. The possible units to convert from and to: "cm" (centimeters), "pix" (pixels), or "deg" (degrees of visual angle).

Usage

mon_conv(mon_obj, value, from, to)

Arguments

mon_obj

Monitor object, as assigned with mon_neat.

value

Number; value (magnitude) of the given unit to convert from. (Can be vector as well.)

from

String; unit ("cm", "pix", or "deg") to convert from.

to

String; unit ("cm", "pix", or "deg") to convert to.

Value

Number (magnitude) in the given output (to) unit.

See Also

mon_neat

Examples

# assign monitor with 50 cm distance, screen width 52 cm and 1920 pixels
my_mon = mon_neat(distance = 50, mon_width_cm = 52, mon_width_pixel = 1920)

# convert 30.4 pixels to degrees of visual angle, for the specified monitor
mon_conv(my_mon, 30.4, 'pix', 'deg') # returns 0.9434492 (degrees)

# convert 0.94 degrees of visual angle to pixels
mon_conv(my_mon, 0.94, 'deg', 'pix') # returns 30.28885 (pixels)

# convert 10 degrees of visual angle to cm
mon_conv(my_mon, 10, from = 'deg', to = 'cm')

# convert 8.748866 cm to pixels
mon_conv(my_mon, 8.748866, from = 'cm', to = 'pix')

neatStats documentation built on Dec. 8, 2022, 1:13 a.m.