]> Pileus Git - grits/commit
Correct FOV_DIST and MPPX calculations
authorAndy Spencer <andy753421@gmail.com>
Wed, 8 Feb 2012 07:35:39 +0000 (07:35 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 8 Feb 2012 08:13:14 +0000 (08:13 +0000)
commit46c47c0bc0785333480ce29b78594e60939efd35
treecb043df6a45490343d4da2b81c28eb957601ba4f
parent64cd64653195ced67f25f6b8560953f420c0746c
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
src/grits-opengl.c
src/grits-util.h
src/grits-viewer.c
src/plugins/test.c