Skip to contents

Takes a single value or vector of distances and returns the visual angle equivalent.

Usage

dist_to_visual_angle(
  vector,
  dist_type = "cm",
  view_dist_cm = 60,
  screen_width_cm = 51,
  screen_width_pixels = 1920
)

Arguments

vector

vector of distances (or single distance)

dist_type

default is "cm". Specify "pixel" for conversion from pixel values.

view_dist_cm

viewing distance in cm. Default of 60cm.

screen_width_cm

used in conversion of pixel values. Default is 51 cm (24" monitor).

screen_width_pixels

used in conversion of pixel values. Default is 1920 pixels.

Value

an equivalent-sized object to the input

Examples

# calculate visual angle for stimulus of 5cm
dist_to_visual_angle(5)
#> [1] 4.771888

# calculate visual angle of stimuli 2 and 10cm width at 50 cm viewing angle
dist_to_visual_angle(c(2,10), view_dist_cm = 50)
#> [1]  2.291526 11.421186

# calculate visual angle of 150 pixel wide
dist_to_visual_angle(150, dist_type = "pixels")
#> [1] 102.6804