add.diffraction: Add all possible diffraction lines to a dispersion plot.

Usage Arguments Examples

Usage

1
add.diffraction(k = seq(par()$usr[1], par()$usr[2], , 100), kgx, kgv, m.range = c(-5, 5), n.range = c(-5, 5), phi = 0, alpha = pi/2, ...)

Arguments

k

the k range to use. default is the current plotting coordinates

kgx

in-plane (phi=0) grating vector

kgv

out-of-plane (phi=alpha) grating vector (if only one grating vector, set this very high so as to not plot in the frequency range)

m.range

range of m*kgx values to evaluate

n.range

range of n*kgv values to evaluate

phi

azimuthal angle in radians

alpha

angle between grating vectors in radians

...

parameters to pass to line()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (k = seq(par()$usr[1], par()$usr[2], , 100), kgx, kgv, 
    m.range = c(-5, 5), n.range = c(-5, 5), phi = 0, alpha = pi/2, 
    ...) 
{
    for (n in -5:5) {
        for (m in -5:5) {
            in.plane <- (sqrt(((k * cos(phi) + m * kgx - n * 
                kgv * cos(alpha))^2) + ((k * sin(phi) - n * kgv * 
                sin(alpha))^2)))
            if (any(max(k)^2 > (in.plane)^2)) {
                lines(diffraction.line(k, kgx, kgv, m, n, phi, 
                  alpha), ...)
            }
        }
    }
  }

tjconstant/photonMonkey documentation built on May 31, 2019, 3:38 p.m.