Distance to Point C++

Usage

distance_2_point(x, y, rx, ry, sw, sh, ez, ex = as.numeric(c(0)), ey = as.numeric(c(0)))

Arguments

x
the horizontal coordinate of a point on a screen (pixels)
y
the vertical coordinate of a point on a screen (pixels)
rx
the horizontal resolution of the screen (pixels)
ry
the vertical resolution of the screen (pixels)
sw
the physical screen width (mm)
sh
the physical screen height (mm)
ez
the perpendicular distance from the viewer to the screen (mm)
ex
the horizontal offset of the viewer from screen center (mm)
ey
the vertical offset of the viewer from screen center (mm)

Description

Takes an x and y screen coordinate and returns the physical distance from the observer to that point on the screen.

Examples

distance_2_point(840, 525, 1680, 1050, 473.76, 296.1, 750)
[1] 750