runif_on_stri: Uniform sampling on a spherical triangle

View source: R/sphere.R

runif_on_striR Documentation

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)

Arguments

n

number of simulations

r

radius

v1, v2, v3

vertices

Value

The simulations in a n times 3 matrix.

Examples

# 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))
## Not run: 
library(rgl)
spheres3d(0, 0, 0, color = "red", alpha = 0.5)
points3d(sims)
## End(Not run)

uniformly documentation built on July 26, 2023, 6:06 p.m.