subtendedAngle: Subtended Angle

Description Usage Arguments Value Author(s) Examples

Description

Takes two screen coordinates and returns the angle (in degrees) subtended by those two points.

Usage

1
subtendedAngle(x1, y1, x2, y2, viewerDistance = 58.74, viewerHeight = 4.55, resolutionX = 1280, resolutionY = 1024, screenWidth = 33.97, screenHeight = 27.31)

Arguments

x1

The x coordinate of the first point on a screen

y1

The y coordinate of the first point on a screen

x2

The x coordinate of the second point on a screen

y2

The y coordinate of the second point on a screen

viewerDistance

Perpendicular distance from the viewer to the screen (cm)

viewerHeight

Vertical height of the viewer above screen center (cm)

resolutionX

The x resolution of the monitor (pixels)

resolutionY

The y resolution of the monitor (pixels)

screenWidth

The physical screen width (cm)

screenHeight

The physical screen height (cm)

Value

The angle (in degrees) subtended by two points

Author(s)

Ryan M. Hope

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
function( x1, y1, x2, y2, viewerDistance=58.74, viewerHeight=4.55, resolutionX=1280, resolutionY=1024, screenWidth=33.97, screenHeight=27.31 ) {
    
    d1 <- distance2point(x1, y1, viewerDistance, viewerHeight, resolutionX, resolutionY, screenWidth, screenHeight)
    d2 <- distance2point(x2, y2, viewerDistance, viewerHeight, resolutionX, resolutionY, screenWidth, screenHeight)
    
    dX <- screenWidth * ( x2 - x1 ) / resolutionX
    dY <- screenWidth * ( y2 - y1 ) / resolutionY
    
    screenDistance <- sqrt( dX^2 + dY^2 )
    
    angleRadians <- acos( ( d1^2 + d2^2 - screenDistance^2 ) / ( 2 * d1 * d2 ) )
    
    angleRadians / ( 2 * pi ) * 360
    
  }

eyetracking documentation built on May 2, 2019, 11:06 a.m.