visangle3D: Calculate visual angle given a 3D viewer position, stimulus...

Description Usage Arguments Value Note See Also Examples

Description

This function calculates the visual angle of a stimulus given a viewer position, stimulus size, and stimulus position. Here I make fewer assumptions and calculate the distance between the viewer and the edges of the object in order to use the law of cosines to calculate the associated angle.

Usage

1
visangle3D(viewerloc, stimloc, stimdim)

Arguments

viewerloc

The location of the center of the viewer as a numeric vector of length 3 c(X,Y,Z)

stimloc

The location of the center of the stimulus as a numeric vector of length 3 c(X,Y,Z)

stimdim

The stimulus dimensions as a numeric vector of length 2 c(width,height)

Value

Degrees in visual angle for the given stimulus dimentions and positions of viewer and stimuli

Note

The units of measure should be the same for all parameters. Z is assumed to be the depth plane.

See Also

visangle

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#corresponds to an offset of 10 and 10 and a viewer distance of 20
viewerloc <- c(0,0,0)
stimloc<-c(10,10,-20) 
stimsize.val <- 10
stimdim <- c(stimsize.val,1)
visangle(stimsize.val,20,pythag(stimloc[1],stimloc[2]))
visangle3D(viewerloc,stimloc,stimdim)
#corresponds to an offset of 10 and 0 and a viewer distance of 20
viewerloc <- c(0,0,0)
stimloc<-c(10,0,-20) 
stimsize.val <- 10
stimdim <- c(stimsize.val,1)
visangle(stimsize.val,20,pythag(stimloc[1],stimloc[2]))
visangle3D(viewerloc,stimloc,stimdim)
visangle3D(list(c(1,1),c(1,1),c(1,1)),list(c(2,2),c(2,2),c(2,2)),list(c(3,3),c(3,3)))
visangle3D(list(1,2,3),list(3,4,5),list(2,2))

drknexus/repsych documentation built on May 15, 2019, 2:19 p.m.