runif_in_tetrahedron: Uniform sampling in a tetrahedron

Description Usage Arguments Value See Also Examples

View source: R/tetrahedron.R

Description

Uniform sampling in a tetrahedron (in dimension 3).

Usage

1
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

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

stla/uniformly documentation built on Aug. 10, 2018, 7:03 a.m.