
Convert a line thickness from degrees of visual angle to pixels
Source:R/palette_prob_bg.R
visual_angle_to_px.RdThe defaults (30 inch viewing distance, 96 dpi) match Szafir (2018)'s own assumed viewing conditions. Override both to match an actual lab setup (measured pixel pitch and viewing distance), rather than trusting a reported dpi, which is frequently wrong for actual displays.
Usage
visual_angle_to_px(
deg,
viewing_distance_in = 30,
dpi = 96,
convention = .C4A$angle_convention
)Arguments
- deg
line thickness in degrees of visual angle
- viewing_distance_in
viewing distance, in inches
- dpi
display resolution, in dots (pixels) per inch
- convention
"szafir"or"standard"– see Details. Defaults to theangle_conventionpackage option (seec4a_options()).
Details
The standard chord formula for the linear size subtending a visual angle
deg at distance d is 2 * d * tan(deg/2) – this is what convention = "standard" computes. Szafir (2018)'s own in-text px-equivalents (e.g.
"0.25 deg (6px)", "2.0 deg (50px)" for points; "0.05 deg (1px)", "0.35 deg
(9px)" for lines) are consistently exactly half of that formula's result
at their own stated 30in/96dpi assumptions – across both experiments, at
four independently checked (angle, px) pairs, which is why this is treated
as their own conversion convention rather than a one-off rounding
difference. convention = "szafir" (the default, and the package default
via c4a_options("angle_convention")) reproduces that, so preview sizes
in palette_prob_bg() / c4a_gui() visually match the paper's own
figures; convention = "standard" gives the textbook-correct value, which
is what you want once calibrating against a real measured display.