runif_in_tetrahedron {uniformly}R Documentation

Uniform sampling in a tetrahedron

Description

Uniform sampling in a tetrahedron (in dimension 3).

Usage

runif_in_tetrahedron(n, v1, v2, v3, v4)

Arguments

n

number of simulations

v1, v2, v3, v4

vertices of the tetrahedron

Value

The simulations in a n times 3 matrix.

See Also

runif_in_simplex for sampling in a simplex in arbitrary dimension.

Examples

library(rgl)
tetrahedron <- tetrahedron3d()
shade3d(tetrahedron, color = "red", alpha = 0.3)
vs <- tetrahedron$vb[1L:3L, ]
sims <- runif_in_tetrahedron(100, vs[, 1], vs[, 2], vs[, 3], vs[, 4])
points3d(sims)

[Package uniformly version 0.5.0 Index]