]>
Pileus Git - grits/commit - src/grits-viewer.c
Correct FOV_DIST and MPPX calculations
Derivation of FOV_DIST for a 1600x1200 monitor
with a vertical viewing angle of 30 degrees:
--- +._
| | '-._ angle
height | | '-._/
(px) | | ('-._
--- +--------------+ (o) eye
|--------------|
FOV_DIST (px)
height = 1200 px
angle = 30 deg
fov_dist = cot(angle)*height = 2078.46
Derivation of angle for window of a given height:
angle = atan(height/FOV_DIST)
Derivation of resolution in meters per pixel
at a given distance:
--- +._
| | '-._
length | | '-._
(m) | | '-._
--- +--------------+ (o) eye
|--------------|
dist (m)
length = tan(angle) * dist
mppx = length / height
= (tan(atan(height/FOV_DIST)) * dist) / height
= dist/FOV_DIST