Convert Display Diagonal Size (inch) to Width and Height (cm)
Source:R/diaginch_to_cm.r
diaginch_to_cm.RdThis function converts a display's diagonal length in inches into its physical width and height in centimeters, assuming a specified aspect ratio. It is useful for psychological experiments and visual stimulus control, where precise physical screen dimensions are required.
Usage
diaginch_to_cm(diagonal_inch, aspect_ratio = c(16, 9))Value
A data frame with two columns:
- width_cm
Width of the display in centimeters.
- height_cm
Height of the display in centimeters.
Examples
# Convert a 24-inch monitor with 16:9 aspect ratio
diaginch_to_cm(24)
#> width_cm height_cm
#> 1 53.13124 29.88633
# Convert multiple displays at once
diaginch_to_cm(c(13, 24, 27))
#> width_cm height_cm
#> 1 28.77942 16.18843
#> 2 53.13124 29.88633
#> 3 59.77265 33.62212
# Convert a 4:3 display
diaginch_to_cm(19, aspect_ratio = c(4, 3))
#> width_cm height_cm
#> 1 38.608 28.956