View source: R/simulationFunctions.R
simulTrajec | R Documentation |
simulTrajec
simulates movement trajectories within a
bounded space, movements are set with speed (h
) and may be correlated
in direction (rho
). Function simulates movement of particles in a video
sequence of certain number of frames (nframes
) in length. Images
are saved as png files.
simulTrajec(
nframes = 20,
nIndividuals = 10,
h = 0.02,
rho = 0,
domain = "square",
correctBoundary = TRUE,
sizes = stats::runif(nIndividuals) * 0.012 + 0.01,
staticNoise = FALSE,
movingNoise = FALSE,
name = "trajectory",
path = NULL,
parsMoving = list(density = 10, duration = 10, size = 1, speed = 10, colRange = c(0,
1)),
parsStatic = list(density = 10, blur = TRUE, blurCoef = 0.025, sizes = NULL, col =
"red"),
width = 480,
height = NULL
)
nframes |
Number of time frames(steps). |
nIndividuals |
Number of individual trajectories. |
h |
Displacement speed in pixels. |
rho |
Correlation parameter for angle of displacement. |
domain |
One of |
correctBoundary |
Logical. |
sizes |
Vector of sizes for each simulated particle of length nIndividuals. |
staticNoise |
Logical. If |
movingNoise |
Logical. If |
name |
Stem of the filename. |
path |
to location where the created images should be saved. By default the working directory is used. |
parsMoving |
List of parameters used to generate moving noise
these include the density of noise particles ( |
parsStatic |
List of parameters used to generate static noise.
These include the density (per image) of noise particles ( |
width |
of created png image. By default 480. |
height |
of create png image. If |
Caspar A. Hallmann, Marjolein Bruijning & Marco D. Visser
## Not run:
dir.create("images")
## Create image sequence and save as png's in the working directory.
traj <- simulTrajec(path="images",
nframes=30,nIndividuals=20,domain="square",
h=0.01,rho=0.9,
sizes=runif(20,0.004,0.006))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.