modify.horizons {SoPhy}R Documentation

Stochastic variation of the definitions of the horizons

Description

The function modies the geometric definition of the horizons stochastically

Usage

modify.horizons(h, percent=5, level.percent=5, rdistr=rnorm)

Arguments

h list of the same format as the output of xswms2d
percent magnitude of variation of a single point; see Details.
level.percent magnitude of the length of the translation vector for the whole object; see Details.
rdistr distribution for the translation. The function must have two parameters: the first parameter gives the number of random variables to generate; the other parameter is called by name, ‘s’, and should determine (or be related to) the standard deviation of the distribution.

Details

The function modify.horizons changes stochastically the location of the vertices of the defining segments for the boundary of a horizon. To this end, the standard deviations s.x and s.y for the x coordinates and the y coordinates of the vertices are calculated. Then the s parameter for the distribution of the translation distance equals s.x * percent / 100 for the x coordinates (analogously for the y coordinates).

modify.horizons calls calculate.horizons before returning the list.

Value

List of the same format as the output of xswms2d.
modify.horizons calls calculate.horizons before returning the list.

Author(s)

Martin Schlather, martin.schlather@math.uni-goettingen.de http://www.stochastik.math.uni-goettingen.de/institute

See Also

SoPhy, xswms2d

Examples

h <- xswms2d(xlim=c(1, 100), ylim=c(1, 100), step=1, new=NULL)
##        new=NULL: xswms2d returns the standard definition for h
##                          without entering the interactive surface
h$n <- 2         ## define a second horizon
h$H2 <- h$H1    
h$H2$type <- "H" ## genuine horizon, not polygon

## coordinates of the boundary segments between the horizons 
h$H2$points <- list(x=seq(1, 100, 5))             ## x coordinates
h$H2$points$y <- 40 + 20 * cos(h$H2$points$x / 5) ## y coordinates

h <- calculate.horizons(h) ## update the internal parameters
draw.horizons(h)           ## plot the horizons
for (i in 1:20) {
  readline("Press return")
  h <- modify.horizons(h)  ## stochastic modification of the horizons
  draw.horizons(h)        
  }

[Package SoPhy version 1.0.34 Index]