Learn R Programming

uniformly (version 0.5.0)

runif_on_stri: Uniform sampling on a spherical triangle

Description

Uniform sampling on a spherical triangle (in dimension 3).

Usage

runif_on_stri(n, r = 1, v1, v2, v3)

Value

The simulations in a n times 3 matrix.

Arguments

n

number of simulations

r

radius

v1, v2, v3

vertices

Examples

Run this code
# sampling on the first orthant:
sims <- runif_on_stri(100, v1 = c(1, 0, 0), v2 = c(0, 1, 0), v3 = c(0, 0, 1))
if (FALSE) {
library(rgl)
spheres3d(0, 0, 0, color = "red", alpha = 0.5)
points3d(sims)}

Run the code above in your browser using DataLab